Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / api / chatProactiveAction / chatProactiveAction.controller.js
index 57961f9..25de7a0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x96f7=['api','../../config/utils','../../config/environment','status','json','count','offset','limit','set','apply','reject','update','destroy','sendStatus','error','stack','name','send','params','model','ChatProactiveAction','rawAttributes','query','keys','intersection','attributes','fields','includeAll','include','options','find','then','catch','create','body','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3bbde7,_0x344127){var _0x117992=function(_0x1d0170){while(--_0x1d0170){_0x3bbde7['push'](_0x3bbde7['shift']());}};_0x117992(++_0x344127);}(_0x96f7,0x91));var _0x796f=function(_0x182b41,_0x3710ca){_0x182b41=_0x182b41-0x0;var _0x39e4dc=_0x96f7[_0x182b41];return _0x39e4dc;};'use strict';var pdf=require(_0x796f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x796f('0x1'));var jsonpatch=require(_0x796f('0x2'));var rp=require(_0x796f('0x3'));var moment=require('moment');var BPromise=require(_0x796f('0x4'));var Mustache=require(_0x796f('0x5'));var util=require(_0x796f('0x6'));var path=require(_0x796f('0x7'));var sox=require(_0x796f('0x8'));var csv=require('to-csv');var ejs=require(_0x796f('0x9'));var fs=require('fs');var _=require(_0x796f('0xa'));var squel=require(_0x796f('0xb'));var crypto=require(_0x796f('0xc'));var jsforce=require(_0x796f('0xd'));var deskjs=require(_0x796f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x796f('0xf'));var Redis=require('ioredis');var authService=require(_0x796f('0x10'));var qs=require(_0x796f('0x11'));var as=require(_0x796f('0x12'));var hardwareService=require(_0x796f('0x13'));var logger=require('../../config/logger')(_0x796f('0x14'));var utils=require(_0x796f('0x15'));var config=require(_0x796f('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45834d,_0x12c577){_0x12c577=_0x12c577||0xcc;return function(_0xf79746){if(_0xf79746){return _0x45834d['sendStatus'](_0x12c577);}return _0x45834d[_0x796f('0x17')](_0x12c577)['end']();};}function respondWithResult(_0x5e0856,_0x654b8d){_0x654b8d=_0x654b8d||0xc8;return function(_0x4c5fe1){if(_0x4c5fe1){return _0x5e0856[_0x796f('0x17')](_0x654b8d)[_0x796f('0x18')](_0x4c5fe1);}};}function respondWithFilteredResult(_0x446594,_0x1c9df7){return function(_0x1e4cbc){if(_0x1e4cbc){var _0x438001=_0x1e4cbc[_0x796f('0x19')],_0x13417d=_0x1c9df7[_0x796f('0x1a')],_0x4630e7=_0x1c9df7[_0x796f('0x1a')]+_0x1c9df7[_0x796f('0x1b')],_0x40f2e5;if(_0x4630e7>=_0x438001){_0x4630e7=_0x438001;_0x40f2e5=0xc8;}else{_0x40f2e5=0xce;}_0x446594['status'](_0x40f2e5);return _0x446594[_0x796f('0x1c')]('Content-Range',_0x13417d+'-'+_0x4630e7+'/'+_0x438001)[_0x796f('0x18')](_0x1e4cbc);}return null;};}function patchUpdates(_0x2ae9d0){return function(_0xb2399){try{jsonpatch[_0x796f('0x1d')](_0xb2399,_0x2ae9d0,!![]);}catch(_0x4d14e2){return BPromise[_0x796f('0x1e')](_0x4d14e2);}return _0xb2399['save']();};}function saveUpdates(_0x2bd881,_0x133e32){return function(_0xa2f35){if(_0xa2f35){return _0xa2f35[_0x796f('0x1f')](_0x2bd881)['then'](function(_0x2913d7){return _0x2913d7;});}return null;};}function removeEntity(_0x4f94fc,_0x57393b){return function(_0x470d84){if(_0x470d84){return _0x470d84[_0x796f('0x20')]()['then'](function(){_0x4f94fc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c2c47,_0x3a2442){return function(_0x193298){if(!_0x193298){_0x3c2c47[_0x796f('0x21')](0x194);}return _0x193298;};}function handleError(_0x8643e8,_0x57dd01){_0x57dd01=_0x57dd01||0x1f4;return function(_0x20248a){logger[_0x796f('0x22')](_0x20248a[_0x796f('0x23')]);if(_0x20248a[_0x796f('0x24')]){delete _0x20248a[_0x796f('0x24')];}_0x8643e8['status'](_0x57dd01)[_0x796f('0x25')](_0x20248a);};}exports['show']=function(_0x22be57,_0x52958c){var _0x410e17={'raw':!![],'where':{'id':_0x22be57[_0x796f('0x26')]['id']}},_0x571a77={};_0x571a77[_0x796f('0x27')]=_['keys'](db[_0x796f('0x28')][_0x796f('0x29')]);_0x571a77[_0x796f('0x2a')]=_[_0x796f('0x2b')](_0x22be57[_0x796f('0x2a')]);_0x571a77['filters']=_[_0x796f('0x2c')](_0x571a77[_0x796f('0x27')],_0x571a77[_0x796f('0x2a')]);_0x410e17[_0x796f('0x2d')]=_[_0x796f('0x2c')](_0x571a77[_0x796f('0x27')],qs[_0x796f('0x2e')](_0x22be57['query'][_0x796f('0x2e')]));_0x410e17[_0x796f('0x2d')]=_0x410e17[_0x796f('0x2d')]['length']?_0x410e17[_0x796f('0x2d')]:_0x571a77[_0x796f('0x27')];if(_0x22be57[_0x796f('0x2a')][_0x796f('0x2f')]){_0x410e17[_0x796f('0x30')]=[{'all':!![]}];}_0x410e17=_['merge']({},_0x410e17,_0x22be57[_0x796f('0x31')]);return db['ChatProactiveAction'][_0x796f('0x32')](_0x410e17)['then'](handleEntityNotFound(_0x52958c,null))[_0x796f('0x33')](respondWithResult(_0x52958c,null))[_0x796f('0x34')](handleError(_0x52958c,null));};exports[_0x796f('0x35')]=function(_0x4ade3e,_0x2188f6){return db[_0x796f('0x28')][_0x796f('0x35')](_0x4ade3e[_0x796f('0x36')],{})[_0x796f('0x33')](respondWithResult(_0x2188f6,0xc9))[_0x796f('0x34')](handleError(_0x2188f6,null));};exports[_0x796f('0x1f')]=function(_0x1a1efd,_0x33a30f){if(_0x1a1efd[_0x796f('0x36')]['id']){delete _0x1a1efd[_0x796f('0x36')]['id'];}return db[_0x796f('0x28')]['find']({'where':{'id':_0x1a1efd[_0x796f('0x26')]['id']}})[_0x796f('0x33')](handleEntityNotFound(_0x33a30f,null))['then'](saveUpdates(_0x1a1efd[_0x796f('0x36')],null))[_0x796f('0x33')](respondWithResult(_0x33a30f,null))['catch'](handleError(_0x33a30f,null));};exports['destroy']=function(_0x2b5441,_0x563c35){return db[_0x796f('0x28')][_0x796f('0x32')]({'where':{'id':_0x2b5441[_0x796f('0x26')]['id']}})[_0x796f('0x33')](handleEntityNotFound(_0x563c35,null))[_0x796f('0x33')](removeEntity(_0x563c35,null))['catch'](handleError(_0x563c35,null));};
\ No newline at end of file
+var _0x6fc4=['update','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','query','filters','intersection','attributes','fields','includeAll','merge','options','find','catch','create','body','eml-format','rimraf','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x6fc4,0x1a0));var _0x46fc=function(_0x3e18bf,_0x387f5e){_0x3e18bf=_0x3e18bf-0x0;var _0x1022e5=_0x6fc4[_0x3e18bf];return _0x1022e5;};'use strict';var emlformat=require(_0x46fc('0x0'));var rimraf=require(_0x46fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x46fc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x46fc('0x3'));var path=require(_0x46fc('0x4'));var sox=require(_0x46fc('0x5'));var csv=require(_0x46fc('0x6'));var ejs=require(_0x46fc('0x7'));var fs=require('fs');var fs_extra=require(_0x46fc('0x8'));var _=require(_0x46fc('0x9'));var squel=require(_0x46fc('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x46fc('0xb'));var toCsv=require(_0x46fc('0x6'));var querystring=require(_0x46fc('0xc'));var Papa=require(_0x46fc('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x46fc('0xe'));var as=require(_0x46fc('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46fc('0x10'))('api');var utils=require(_0x46fc('0x11'));var config=require(_0x46fc('0x12'));var licenseUtil=require(_0x46fc('0x13'));var db=require(_0x46fc('0x14'))['db'];function respondWithStatusCode(_0x317f01,_0x36ec39){_0x36ec39=_0x36ec39||0xcc;return function(_0x1013ae){if(_0x1013ae){return _0x317f01[_0x46fc('0x15')](_0x36ec39);}return _0x317f01[_0x46fc('0x16')](_0x36ec39)[_0x46fc('0x17')]();};}function respondWithResult(_0x34a019,_0x403564){_0x403564=_0x403564||0xc8;return function(_0x36f17c){if(_0x36f17c){return _0x34a019[_0x46fc('0x16')](_0x403564)[_0x46fc('0x18')](_0x36f17c);}};}function respondWithFilteredResult(_0x39aa74,_0x246499){return function(_0x67f365){if(_0x67f365){var _0x51ab37=typeof _0x246499[_0x46fc('0x19')]===_0x46fc('0x1a')&&typeof _0x246499[_0x46fc('0x1b')]===_0x46fc('0x1a');var _0xd40ad2=_0x67f365['count'];var _0x23b041=_0x51ab37?0x0:_0x246499[_0x46fc('0x19')];var _0x2ebd06=_0x51ab37?_0x67f365[_0x46fc('0x1c')]:_0x246499[_0x46fc('0x19')]+_0x246499[_0x46fc('0x1b')];var _0x5d168a;if(_0x2ebd06>=_0xd40ad2){_0x2ebd06=_0xd40ad2;_0x5d168a=0xc8;}else{_0x5d168a=0xce;}_0x39aa74[_0x46fc('0x16')](_0x5d168a);return _0x39aa74['set'](_0x46fc('0x1d'),_0x23b041+'-'+_0x2ebd06+'/'+_0xd40ad2)[_0x46fc('0x18')](_0x67f365);}return null;};}function patchUpdates(_0x1e6f26){return function(_0x126bf1){try{jsonpatch['apply'](_0x126bf1,_0x1e6f26,!![]);}catch(_0x568f87){return BPromise[_0x46fc('0x1e')](_0x568f87);}return _0x126bf1[_0x46fc('0x1f')]();};}function saveUpdates(_0x1bbc88,_0x48d00f){return function(_0x483acf){if(_0x483acf){return _0x483acf[_0x46fc('0x20')](_0x1bbc88)[_0x46fc('0x21')](function(_0x5b8731){return _0x5b8731;});}return null;};}function removeEntity(_0x720693,_0x9cbc15){return function(_0x372c6f){if(_0x372c6f){return _0x372c6f[_0x46fc('0x22')]()[_0x46fc('0x21')](function(){_0x720693[_0x46fc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16a8e3,_0x352c0f){return function(_0x4f8ad7){if(!_0x4f8ad7){_0x16a8e3[_0x46fc('0x15')](0x194);}return _0x4f8ad7;};}function handleError(_0x28f575,_0x5d5bcc){_0x5d5bcc=_0x5d5bcc||0x1f4;return function(_0x4442f0){logger[_0x46fc('0x23')](_0x4442f0[_0x46fc('0x24')]);if(_0x4442f0[_0x46fc('0x25')]){delete _0x4442f0[_0x46fc('0x25')];}_0x28f575[_0x46fc('0x16')](_0x5d5bcc)[_0x46fc('0x26')](_0x4442f0);};}exports[_0x46fc('0x27')]=function(_0x448f91,_0x29e78d){var _0x3591f9={'raw':!![],'where':{'id':_0x448f91[_0x46fc('0x28')]['id']}},_0x38f8f5={};_0x38f8f5[_0x46fc('0x29')]=_[_0x46fc('0x2a')](db[_0x46fc('0x2b')]['rawAttributes']);_0x38f8f5[_0x46fc('0x2c')]=_[_0x46fc('0x2a')](_0x448f91[_0x46fc('0x2c')]);_0x38f8f5[_0x46fc('0x2d')]=_[_0x46fc('0x2e')](_0x38f8f5[_0x46fc('0x29')],_0x38f8f5['query']);_0x3591f9[_0x46fc('0x2f')]=_[_0x46fc('0x2e')](_0x38f8f5[_0x46fc('0x29')],qs[_0x46fc('0x30')](_0x448f91[_0x46fc('0x2c')][_0x46fc('0x30')]));_0x3591f9[_0x46fc('0x2f')]=_0x3591f9['attributes']['length']?_0x3591f9[_0x46fc('0x2f')]:_0x38f8f5[_0x46fc('0x29')];if(_0x448f91[_0x46fc('0x2c')][_0x46fc('0x31')]){_0x3591f9['include']=[{'all':!![]}];}_0x3591f9=_[_0x46fc('0x32')]({},_0x3591f9,_0x448f91[_0x46fc('0x33')]);return db[_0x46fc('0x2b')][_0x46fc('0x34')](_0x3591f9)[_0x46fc('0x21')](handleEntityNotFound(_0x29e78d,null))[_0x46fc('0x21')](respondWithResult(_0x29e78d,null))[_0x46fc('0x35')](handleError(_0x29e78d,null));};exports[_0x46fc('0x36')]=function(_0x1d075e,_0x1efc32){return db['ChatProactiveAction'][_0x46fc('0x36')](_0x1d075e[_0x46fc('0x37')],{})[_0x46fc('0x21')](respondWithResult(_0x1efc32,0xc9))[_0x46fc('0x35')](handleError(_0x1efc32,null));};exports[_0x46fc('0x20')]=function(_0xa85ff6,_0x5bc0e4){if(_0xa85ff6[_0x46fc('0x37')]['id']){delete _0xa85ff6[_0x46fc('0x37')]['id'];}return db[_0x46fc('0x2b')]['find']({'where':{'id':_0xa85ff6[_0x46fc('0x28')]['id']}})[_0x46fc('0x21')](handleEntityNotFound(_0x5bc0e4,null))[_0x46fc('0x21')](saveUpdates(_0xa85ff6[_0x46fc('0x37')],null))[_0x46fc('0x21')](respondWithResult(_0x5bc0e4,null))[_0x46fc('0x35')](handleError(_0x5bc0e4,null));};exports['destroy']=function(_0x272595,_0x3dac4d){return db[_0x46fc('0x2b')][_0x46fc('0x34')]({'where':{'id':_0x272595['params']['id']}})[_0x46fc('0x21')](handleEntityNotFound(_0x3dac4d,null))[_0x46fc('0x21')](removeEntity(_0x3dac4d,null))[_0x46fc('0x35')](handleError(_0x3dac4d,null));};
\ No newline at end of file