Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / api / chatProactiveAction / chatProactiveAction.controller.js
index 8fa35c5..d390a7e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbcc7=['find','create','body','catch','eml-format','rimraf','fast-json-patch','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','keys','ChatProactiveAction','filters','intersection','model','query','fields','attributes','length','includeAll','include','merge','options'];(function(_0x360678,_0xaf7688){var _0x1b127c=function(_0x1bdebf){while(--_0x1bdebf){_0x360678['push'](_0x360678['shift']());}};_0x1b127c(++_0xaf7688);}(_0xbcc7,0x19a));var _0x7bcc=function(_0x5a4d9c,_0x4f8c2b){_0x5a4d9c=_0x5a4d9c-0x0;var _0xbe8518=_0xbcc7[_0x5a4d9c];return _0xbe8518;};'use strict';var emlformat=require(_0x7bcc('0x0'));var rimraf=require(_0x7bcc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7bcc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7bcc('0x3'));var Mustache=require('mustache');var util=require(_0x7bcc('0x4'));var path=require(_0x7bcc('0x5'));var sox=require('sox');var csv=require(_0x7bcc('0x6'));var ejs=require(_0x7bcc('0x7'));var fs=require('fs');var fs_extra=require(_0x7bcc('0x8'));var _=require(_0x7bcc('0x9'));var squel=require(_0x7bcc('0xa'));var crypto=require(_0x7bcc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7bcc('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7bcc('0xd'));var Papa=require(_0x7bcc('0xe'));var Redis=require('ioredis');var authService=require(_0x7bcc('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7bcc('0x10'))(_0x7bcc('0x11'));var utils=require(_0x7bcc('0x12'));var config=require(_0x7bcc('0x13'));var licenseUtil=require(_0x7bcc('0x14'));var db=require(_0x7bcc('0x15'))['db'];function respondWithStatusCode(_0xae46e8,_0x51b0e8){_0x51b0e8=_0x51b0e8||0xcc;return function(_0x3e3580){if(_0x3e3580){return _0xae46e8[_0x7bcc('0x16')](_0x51b0e8);}return _0xae46e8[_0x7bcc('0x17')](_0x51b0e8)[_0x7bcc('0x18')]();};}function respondWithResult(_0x39f912,_0x217896){_0x217896=_0x217896||0xc8;return function(_0x4a2539){if(_0x4a2539){return _0x39f912[_0x7bcc('0x17')](_0x217896)[_0x7bcc('0x19')](_0x4a2539);}};}function respondWithFilteredResult(_0x148618,_0x461ff7){return function(_0x30caa2){if(_0x30caa2){var _0x134d55=typeof _0x461ff7[_0x7bcc('0x1a')]==='undefined'&&typeof _0x461ff7[_0x7bcc('0x1b')]==='undefined';var _0x3156f3=_0x30caa2[_0x7bcc('0x1c')];var _0x340bd6=_0x134d55?0x0:_0x461ff7[_0x7bcc('0x1a')];var _0x49168c=_0x134d55?_0x30caa2['count']:_0x461ff7[_0x7bcc('0x1a')]+_0x461ff7[_0x7bcc('0x1b')];var _0x1a1b7f;if(_0x49168c>=_0x3156f3){_0x49168c=_0x3156f3;_0x1a1b7f=0xc8;}else{_0x1a1b7f=0xce;}_0x148618[_0x7bcc('0x17')](_0x1a1b7f);return _0x148618[_0x7bcc('0x1d')](_0x7bcc('0x1e'),_0x340bd6+'-'+_0x49168c+'/'+_0x3156f3)[_0x7bcc('0x19')](_0x30caa2);}return null;};}function patchUpdates(_0x3d0719){return function(_0x15b2c3){try{jsonpatch['apply'](_0x15b2c3,_0x3d0719,!![]);}catch(_0x553865){return BPromise[_0x7bcc('0x1f')](_0x553865);}return _0x15b2c3[_0x7bcc('0x20')]();};}function saveUpdates(_0x34ee2a,_0x3050cf){return function(_0x201f40){if(_0x201f40){return _0x201f40[_0x7bcc('0x21')](_0x34ee2a)[_0x7bcc('0x22')](function(_0x345671){return _0x345671;});}return null;};}function removeEntity(_0x32b3ea,_0x54c611){return function(_0x2d25b8){if(_0x2d25b8){return _0x2d25b8[_0x7bcc('0x23')]()[_0x7bcc('0x22')](function(){_0x32b3ea[_0x7bcc('0x17')](0xcc)[_0x7bcc('0x18')]();});}};}function handleEntityNotFound(_0x1d085c,_0x4f8562){return function(_0x48b296){if(!_0x48b296){_0x1d085c[_0x7bcc('0x16')](0x194);}return _0x48b296;};}function handleError(_0x4a91d0,_0x4db3c0){_0x4db3c0=_0x4db3c0||0x1f4;return function(_0xd3ca3b){logger['error'](_0xd3ca3b[_0x7bcc('0x24')]);if(_0xd3ca3b[_0x7bcc('0x25')]){delete _0xd3ca3b[_0x7bcc('0x25')];}_0x4a91d0['status'](_0x4db3c0)[_0x7bcc('0x26')](_0xd3ca3b);};}exports[_0x7bcc('0x27')]=function(_0x2e92e1,_0x319943){var _0x20c458={'raw':!![],'where':{'id':_0x2e92e1[_0x7bcc('0x28')]['id']}},_0x1ecf95={};_0x1ecf95['model']=_[_0x7bcc('0x29')](db[_0x7bcc('0x2a')]['rawAttributes']);_0x1ecf95['query']=_[_0x7bcc('0x29')](_0x2e92e1['query']);_0x1ecf95[_0x7bcc('0x2b')]=_[_0x7bcc('0x2c')](_0x1ecf95[_0x7bcc('0x2d')],_0x1ecf95[_0x7bcc('0x2e')]);_0x20c458['attributes']=_[_0x7bcc('0x2c')](_0x1ecf95[_0x7bcc('0x2d')],qs[_0x7bcc('0x2f')](_0x2e92e1['query'][_0x7bcc('0x2f')]));_0x20c458[_0x7bcc('0x30')]=_0x20c458[_0x7bcc('0x30')][_0x7bcc('0x31')]?_0x20c458[_0x7bcc('0x30')]:_0x1ecf95[_0x7bcc('0x2d')];if(_0x2e92e1[_0x7bcc('0x2e')][_0x7bcc('0x32')]){_0x20c458[_0x7bcc('0x33')]=[{'all':!![]}];}_0x20c458=_[_0x7bcc('0x34')]({},_0x20c458,_0x2e92e1[_0x7bcc('0x35')]);return db['ChatProactiveAction'][_0x7bcc('0x36')](_0x20c458)[_0x7bcc('0x22')](handleEntityNotFound(_0x319943,null))[_0x7bcc('0x22')](respondWithResult(_0x319943,null))['catch'](handleError(_0x319943,null));};exports['create']=function(_0x409ff4,_0x1ef50b){return db[_0x7bcc('0x2a')][_0x7bcc('0x37')](_0x409ff4[_0x7bcc('0x38')],{})[_0x7bcc('0x22')](respondWithResult(_0x1ef50b,0xc9))[_0x7bcc('0x39')](handleError(_0x1ef50b,null));};exports['update']=function(_0x5bbb4b,_0x5584f6){if(_0x5bbb4b['body']['id']){delete _0x5bbb4b[_0x7bcc('0x38')]['id'];}return db[_0x7bcc('0x2a')][_0x7bcc('0x36')]({'where':{'id':_0x5bbb4b['params']['id']}})[_0x7bcc('0x22')](handleEntityNotFound(_0x5584f6,null))[_0x7bcc('0x22')](saveUpdates(_0x5bbb4b[_0x7bcc('0x38')],null))['then'](respondWithResult(_0x5584f6,null))['catch'](handleError(_0x5584f6,null));};exports[_0x7bcc('0x23')]=function(_0xca6ce3,_0x1d9c06){return db['ChatProactiveAction']['find']({'where':{'id':_0xca6ce3[_0x7bcc('0x28')]['id']}})[_0x7bcc('0x22')](handleEntityNotFound(_0x1d9c06,null))[_0x7bcc('0x22')](removeEntity(_0x1d9c06,null))['catch'](handleError(_0x1d9c06,null));};
\ No newline at end of file
+var _0x9aee=['body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','end','error','name','send','params','model','keys','ChatProactiveAction','query','filters','intersection','attributes','fields','include','options','find','then','catch','create'];(function(_0x1d4ea9,_0x3f1d85){var _0x2cf5eb=function(_0x145f17){while(--_0x145f17){_0x1d4ea9['push'](_0x1d4ea9['shift']());}};_0x2cf5eb(++_0x3f1d85);}(_0x9aee,0x71));var _0xe9ae=function(_0x440f53,_0x58aa56){_0x440f53=_0x440f53-0x0;var _0x190b07=_0x9aee[_0x440f53];return _0x190b07;};'use strict';var emlformat=require(_0xe9ae('0x0'));var rimraf=require(_0xe9ae('0x1'));var zipdir=require(_0xe9ae('0x2'));var jsonpatch=require(_0xe9ae('0x3'));var rp=require(_0xe9ae('0x4'));var moment=require(_0xe9ae('0x5'));var BPromise=require(_0xe9ae('0x6'));var Mustache=require(_0xe9ae('0x7'));var util=require(_0xe9ae('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe9ae('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe9ae('0xa'));var crypto=require('crypto');var jsforce=require(_0xe9ae('0xb'));var deskjs=require(_0xe9ae('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe9ae('0xd'));var Papa=require(_0xe9ae('0xe'));var Redis=require(_0xe9ae('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe9ae('0x10'));var as=require(_0xe9ae('0x11'));var hardwareService=require(_0xe9ae('0x12'));var logger=require('../../config/logger')(_0xe9ae('0x13'));var utils=require('../../config/utils');var config=require(_0xe9ae('0x14'));var licenseUtil=require(_0xe9ae('0x15'));var db=require(_0xe9ae('0x16'))['db'];function respondWithStatusCode(_0x1833c9,_0x3f55e5){_0x3f55e5=_0x3f55e5||0xcc;return function(_0x1be4dd){if(_0x1be4dd){return _0x1833c9[_0xe9ae('0x17')](_0x3f55e5);}return _0x1833c9[_0xe9ae('0x18')](_0x3f55e5)['end']();};}function respondWithResult(_0x2f2c3b,_0x38b4af){_0x38b4af=_0x38b4af||0xc8;return function(_0x4e8869){if(_0x4e8869){return _0x2f2c3b[_0xe9ae('0x18')](_0x38b4af)[_0xe9ae('0x19')](_0x4e8869);}};}function respondWithFilteredResult(_0x44fa8c,_0x43963c){return function(_0x3ef25b){if(_0x3ef25b){var _0x1fd836=typeof _0x43963c[_0xe9ae('0x1a')]===_0xe9ae('0x1b')&&typeof _0x43963c[_0xe9ae('0x1c')]==='undefined';var _0x5b18ae=_0x3ef25b[_0xe9ae('0x1d')];var _0x4bae07=_0x1fd836?0x0:_0x43963c[_0xe9ae('0x1a')];var _0x32748a=_0x1fd836?_0x3ef25b[_0xe9ae('0x1d')]:_0x43963c[_0xe9ae('0x1a')]+_0x43963c['limit'];var _0x4e9e93;if(_0x32748a>=_0x5b18ae){_0x32748a=_0x5b18ae;_0x4e9e93=0xc8;}else{_0x4e9e93=0xce;}_0x44fa8c['status'](_0x4e9e93);return _0x44fa8c[_0xe9ae('0x1e')](_0xe9ae('0x1f'),_0x4bae07+'-'+_0x32748a+'/'+_0x5b18ae)['json'](_0x3ef25b);}return null;};}function patchUpdates(_0x1ad4d5){return function(_0x49fc40){try{jsonpatch[_0xe9ae('0x20')](_0x49fc40,_0x1ad4d5,!![]);}catch(_0x324de0){return BPromise[_0xe9ae('0x21')](_0x324de0);}return _0x49fc40['save']();};}function saveUpdates(_0x4a7568,_0x475b7a){return function(_0x206bd7){if(_0x206bd7){return _0x206bd7[_0xe9ae('0x22')](_0x4a7568)['then'](function(_0x36285a){return _0x36285a;});}return null;};}function removeEntity(_0x29d690,_0x31e94f){return function(_0x3fd466){if(_0x3fd466){return _0x3fd466[_0xe9ae('0x23')]()['then'](function(){_0x29d690[_0xe9ae('0x18')](0xcc)[_0xe9ae('0x24')]();});}};}function handleEntityNotFound(_0x9f1726,_0x209236){return function(_0x5cec8a){if(!_0x5cec8a){_0x9f1726[_0xe9ae('0x17')](0x194);}return _0x5cec8a;};}function handleError(_0x5195ce,_0x3e78ca){_0x3e78ca=_0x3e78ca||0x1f4;return function(_0x18e5b3){logger[_0xe9ae('0x25')](_0x18e5b3['stack']);if(_0x18e5b3[_0xe9ae('0x26')]){delete _0x18e5b3[_0xe9ae('0x26')];}_0x5195ce[_0xe9ae('0x18')](_0x3e78ca)[_0xe9ae('0x27')](_0x18e5b3);};}exports['show']=function(_0x266f36,_0x3db24e){var _0x483df4={'raw':!![],'where':{'id':_0x266f36[_0xe9ae('0x28')]['id']}},_0x4ac613={};_0x4ac613[_0xe9ae('0x29')]=_[_0xe9ae('0x2a')](db[_0xe9ae('0x2b')]['rawAttributes']);_0x4ac613[_0xe9ae('0x2c')]=_['keys'](_0x266f36[_0xe9ae('0x2c')]);_0x4ac613[_0xe9ae('0x2d')]=_[_0xe9ae('0x2e')](_0x4ac613[_0xe9ae('0x29')],_0x4ac613[_0xe9ae('0x2c')]);_0x483df4[_0xe9ae('0x2f')]=_['intersection'](_0x4ac613[_0xe9ae('0x29')],qs[_0xe9ae('0x30')](_0x266f36[_0xe9ae('0x2c')][_0xe9ae('0x30')]));_0x483df4[_0xe9ae('0x2f')]=_0x483df4[_0xe9ae('0x2f')]['length']?_0x483df4[_0xe9ae('0x2f')]:_0x4ac613[_0xe9ae('0x29')];if(_0x266f36[_0xe9ae('0x2c')]['includeAll']){_0x483df4[_0xe9ae('0x31')]=[{'all':!![]}];}_0x483df4=_['merge']({},_0x483df4,_0x266f36[_0xe9ae('0x32')]);return db[_0xe9ae('0x2b')][_0xe9ae('0x33')](_0x483df4)['then'](handleEntityNotFound(_0x3db24e,null))[_0xe9ae('0x34')](respondWithResult(_0x3db24e,null))[_0xe9ae('0x35')](handleError(_0x3db24e,null));};exports[_0xe9ae('0x36')]=function(_0x416bae,_0x161c77){return db[_0xe9ae('0x2b')]['create'](_0x416bae[_0xe9ae('0x37')],{})[_0xe9ae('0x34')](respondWithResult(_0x161c77,0xc9))['catch'](handleError(_0x161c77,null));};exports[_0xe9ae('0x22')]=function(_0x2813a0,_0x22c47c){if(_0x2813a0['body']['id']){delete _0x2813a0[_0xe9ae('0x37')]['id'];}return db['ChatProactiveAction'][_0xe9ae('0x33')]({'where':{'id':_0x2813a0[_0xe9ae('0x28')]['id']}})[_0xe9ae('0x34')](handleEntityNotFound(_0x22c47c,null))[_0xe9ae('0x34')](saveUpdates(_0x2813a0['body'],null))[_0xe9ae('0x34')](respondWithResult(_0x22c47c,null))['catch'](handleError(_0x22c47c,null));};exports[_0xe9ae('0x23')]=function(_0x50d500,_0x52e381){return db[_0xe9ae('0x2b')]['find']({'where':{'id':_0x50d500[_0xe9ae('0x28')]['id']}})[_0xe9ae('0x34')](handleEntityNotFound(_0x52e381,null))[_0xe9ae('0x34')](removeEntity(_0x52e381,null))[_0xe9ae('0x35')](handleError(_0x52e381,null));};
\ No newline at end of file