Built motion from commit 6a09e18b.|2.6.11
[motion2.git] / server / api / chatProactiveAction / chatProactiveAction.controller.js
index 7ba4348..818f139 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbf4e=['create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','stack','name','send','model','query','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','ChatProactiveAction','find','catch'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xbf4e,0x172));var _0xebf4=function(_0x26a195,_0x1de571){_0x26a195=_0x26a195-0x0;var _0x50cee6=_0xbf4e[_0x26a195];return _0x50cee6;};'use strict';var emlformat=require(_0xebf4('0x0'));var rimraf=require(_0xebf4('0x1'));var zipdir=require(_0xebf4('0x2'));var jsonpatch=require(_0xebf4('0x3'));var rp=require(_0xebf4('0x4'));var moment=require(_0xebf4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xebf4('0x6'));var util=require('util');var path=require('path');var sox=require(_0xebf4('0x7'));var csv=require(_0xebf4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xebf4('0x9'));var _=require(_0xebf4('0xa'));var squel=require(_0xebf4('0xb'));var crypto=require('crypto');var jsforce=require(_0xebf4('0xc'));var deskjs=require(_0xebf4('0xd'));var toCsv=require(_0xebf4('0x8'));var querystring=require(_0xebf4('0xe'));var Papa=require(_0xebf4('0xf'));var Redis=require(_0xebf4('0x10'));var authService=require(_0xebf4('0x11'));var qs=require(_0xebf4('0x12'));var as=require(_0xebf4('0x13'));var hardwareService=require(_0xebf4('0x14'));var logger=require(_0xebf4('0x15'))(_0xebf4('0x16'));var utils=require(_0xebf4('0x17'));var config=require(_0xebf4('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xebf4('0x19'))['db'];function respondWithStatusCode(_0x3432a1,_0x25404b){_0x25404b=_0x25404b||0xcc;return function(_0x4a2ba6){if(_0x4a2ba6){return _0x3432a1['sendStatus'](_0x25404b);}return _0x3432a1[_0xebf4('0x1a')](_0x25404b)[_0xebf4('0x1b')]();};}function respondWithResult(_0x3f5bc2,_0x102068){_0x102068=_0x102068||0xc8;return function(_0x4387b7){if(_0x4387b7){return _0x3f5bc2[_0xebf4('0x1a')](_0x102068)[_0xebf4('0x1c')](_0x4387b7);}};}function respondWithFilteredResult(_0x46fe98,_0x59c2db){return function(_0x313880){if(_0x313880){var _0x14c06d=typeof _0x59c2db[_0xebf4('0x1d')]===_0xebf4('0x1e')&&typeof _0x59c2db[_0xebf4('0x1f')]===_0xebf4('0x1e');var _0x43cd50=_0x313880[_0xebf4('0x20')];var _0x4e83a8=_0x14c06d?0x0:_0x59c2db['offset'];var _0x5db628=_0x14c06d?_0x313880[_0xebf4('0x20')]:_0x59c2db[_0xebf4('0x1d')]+_0x59c2db[_0xebf4('0x1f')];var _0x18ade2;if(_0x5db628>=_0x43cd50){_0x5db628=_0x43cd50;_0x18ade2=0xc8;}else{_0x18ade2=0xce;}_0x46fe98[_0xebf4('0x1a')](_0x18ade2);return _0x46fe98[_0xebf4('0x21')](_0xebf4('0x22'),_0x4e83a8+'-'+_0x5db628+'/'+_0x43cd50)[_0xebf4('0x1c')](_0x313880);}return null;};}function patchUpdates(_0x153d7d){return function(_0x522093){try{jsonpatch[_0xebf4('0x23')](_0x522093,_0x153d7d,!![]);}catch(_0x265582){return BPromise[_0xebf4('0x24')](_0x265582);}return _0x522093[_0xebf4('0x25')]();};}function saveUpdates(_0x3b3f67,_0x3ffc03){return function(_0x2eee12){if(_0x2eee12){return _0x2eee12['update'](_0x3b3f67)[_0xebf4('0x26')](function(_0x13a86b){return _0x13a86b;});}return null;};}function removeEntity(_0x5456ab,_0x526034){return function(_0x5403a3){if(_0x5403a3){return _0x5403a3['destroy']()[_0xebf4('0x26')](function(){_0x5456ab[_0xebf4('0x1a')](0xcc)[_0xebf4('0x1b')]();});}};}function handleEntityNotFound(_0x31c070,_0x129aba){return function(_0x467c70){if(!_0x467c70){_0x31c070[_0xebf4('0x27')](0x194);}return _0x467c70;};}function handleError(_0x11ca94,_0x504349){_0x504349=_0x504349||0x1f4;return function(_0x19527e){logger['error'](_0x19527e[_0xebf4('0x28')]);if(_0x19527e[_0xebf4('0x29')]){delete _0x19527e['name'];}_0x11ca94[_0xebf4('0x1a')](_0x504349)[_0xebf4('0x2a')](_0x19527e);};}exports['show']=function(_0x64293d,_0x484305){var _0xd33862={'raw':!![],'where':{'id':_0x64293d['params']['id']}},_0x3632c9={};_0x3632c9[_0xebf4('0x2b')]=_['keys'](db['ChatProactiveAction']['rawAttributes']);_0x3632c9[_0xebf4('0x2c')]=_[_0xebf4('0x2d')](_0x64293d['query']);_0x3632c9[_0xebf4('0x2e')]=_[_0xebf4('0x2f')](_0x3632c9['model'],_0x3632c9[_0xebf4('0x2c')]);_0xd33862[_0xebf4('0x30')]=_[_0xebf4('0x2f')](_0x3632c9[_0xebf4('0x2b')],qs[_0xebf4('0x31')](_0x64293d['query'][_0xebf4('0x31')]));_0xd33862[_0xebf4('0x30')]=_0xd33862[_0xebf4('0x30')][_0xebf4('0x32')]?_0xd33862[_0xebf4('0x30')]:_0x3632c9[_0xebf4('0x2b')];if(_0x64293d[_0xebf4('0x2c')][_0xebf4('0x33')]){_0xd33862['include']=[{'all':!![]}];}_0xd33862=_[_0xebf4('0x34')]({},_0xd33862,_0x64293d[_0xebf4('0x35')]);return db[_0xebf4('0x36')][_0xebf4('0x37')](_0xd33862)['then'](handleEntityNotFound(_0x484305,null))['then'](respondWithResult(_0x484305,null))[_0xebf4('0x38')](handleError(_0x484305,null));};exports[_0xebf4('0x39')]=function(_0xd982a0,_0x5164e0){return db['ChatProactiveAction'][_0xebf4('0x39')](_0xd982a0[_0xebf4('0x3a')],{})['then'](respondWithResult(_0x5164e0,0xc9))[_0xebf4('0x38')](handleError(_0x5164e0,null));};exports['update']=function(_0x348455,_0xcb1d88){if(_0x348455[_0xebf4('0x3a')]['id']){delete _0x348455['body']['id'];}return db[_0xebf4('0x36')]['find']({'where':{'id':_0x348455[_0xebf4('0x3b')]['id']}})[_0xebf4('0x26')](handleEntityNotFound(_0xcb1d88,null))[_0xebf4('0x26')](saveUpdates(_0x348455[_0xebf4('0x3a')],null))[_0xebf4('0x26')](respondWithResult(_0xcb1d88,null))[_0xebf4('0x38')](handleError(_0xcb1d88,null));};exports[_0xebf4('0x3c')]=function(_0x269afb,_0x3cbbbb){return db['ChatProactiveAction']['find']({'where':{'id':_0x269afb[_0xebf4('0x3b')]['id']}})[_0xebf4('0x26')](handleEntityNotFound(_0x3cbbbb,null))[_0xebf4('0x26')](removeEntity(_0x3cbbbb,null))['catch'](handleError(_0x3cbbbb,null));};
\ No newline at end of file
+var _0x7a08=['jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','error','stack','name','send','show','params','keys','ChatProactiveAction','query','intersection','model','attributes','fields','length','includeAll','include','find','catch','create','body','update','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0xdf1858,_0x5692d0){var _0x3e64f0=function(_0x6a8e44){while(--_0x6a8e44){_0xdf1858['push'](_0xdf1858['shift']());}};_0x3e64f0(++_0x5692d0);}(_0x7a08,0x11e));var _0x87a0=function(_0x57ee1d,_0x54111b){_0x57ee1d=_0x57ee1d-0x0;var _0x12a933=_0x7a08[_0x57ee1d];return _0x12a933;};'use strict';var emlformat=require(_0x87a0('0x0'));var rimraf=require(_0x87a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x87a0('0x2'));var moment=require(_0x87a0('0x3'));var BPromise=require(_0x87a0('0x4'));var Mustache=require(_0x87a0('0x5'));var util=require(_0x87a0('0x6'));var path=require(_0x87a0('0x7'));var sox=require(_0x87a0('0x8'));var csv=require(_0x87a0('0x9'));var ejs=require(_0x87a0('0xa'));var fs=require('fs');var fs_extra=require(_0x87a0('0xb'));var _=require(_0x87a0('0xc'));var squel=require('squel');var crypto=require(_0x87a0('0xd'));var jsforce=require(_0x87a0('0xe'));var deskjs=require(_0x87a0('0xf'));var toCsv=require(_0x87a0('0x9'));var querystring=require(_0x87a0('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x87a0('0x11'));var qs=require(_0x87a0('0x12'));var as=require(_0x87a0('0x13'));var hardwareService=require(_0x87a0('0x14'));var logger=require(_0x87a0('0x15'))('api');var utils=require(_0x87a0('0x16'));var config=require(_0x87a0('0x17'));var licenseUtil=require(_0x87a0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54cdf,_0x2bd845){_0x2bd845=_0x2bd845||0xcc;return function(_0x12e8c7){if(_0x12e8c7){return _0x54cdf[_0x87a0('0x19')](_0x2bd845);}return _0x54cdf['status'](_0x2bd845)[_0x87a0('0x1a')]();};}function respondWithResult(_0x288747,_0x290a29){_0x290a29=_0x290a29||0xc8;return function(_0x583bdd){if(_0x583bdd){return _0x288747[_0x87a0('0x1b')](_0x290a29)[_0x87a0('0x1c')](_0x583bdd);}};}function respondWithFilteredResult(_0x3f69f3,_0x35f9a8){return function(_0x4acba8){if(_0x4acba8){var _0x394291=typeof _0x35f9a8['offset']===_0x87a0('0x1d')&&typeof _0x35f9a8[_0x87a0('0x1e')]===_0x87a0('0x1d');var _0x26a72e=_0x4acba8[_0x87a0('0x1f')];var _0x4f695b=_0x394291?0x0:_0x35f9a8[_0x87a0('0x20')];var _0x57bf72=_0x394291?_0x4acba8['count']:_0x35f9a8[_0x87a0('0x20')]+_0x35f9a8[_0x87a0('0x1e')];var _0x2a42ea;if(_0x57bf72>=_0x26a72e){_0x57bf72=_0x26a72e;_0x2a42ea=0xc8;}else{_0x2a42ea=0xce;}_0x3f69f3['status'](_0x2a42ea);return _0x3f69f3[_0x87a0('0x21')]('Content-Range',_0x4f695b+'-'+_0x57bf72+'/'+_0x26a72e)['json'](_0x4acba8);}return null;};}function patchUpdates(_0x1c3b20){return function(_0x237192){try{jsonpatch[_0x87a0('0x22')](_0x237192,_0x1c3b20,!![]);}catch(_0x390bb2){return BPromise[_0x87a0('0x23')](_0x390bb2);}return _0x237192[_0x87a0('0x24')]();};}function saveUpdates(_0x59e839,_0x25ed19){return function(_0x1f59f7){if(_0x1f59f7){return _0x1f59f7['update'](_0x59e839)[_0x87a0('0x25')](function(_0x1cd50c){return _0x1cd50c;});}return null;};}function removeEntity(_0x48dfe2,_0x373507){return function(_0x4fb8d8){if(_0x4fb8d8){return _0x4fb8d8[_0x87a0('0x26')]()[_0x87a0('0x25')](function(){_0x48dfe2[_0x87a0('0x1b')](0xcc)[_0x87a0('0x1a')]();});}};}function handleEntityNotFound(_0x3bb9c0,_0x3f282d){return function(_0x3ae0c0){if(!_0x3ae0c0){_0x3bb9c0[_0x87a0('0x19')](0x194);}return _0x3ae0c0;};}function handleError(_0xae4ee9,_0x3c0a46){_0x3c0a46=_0x3c0a46||0x1f4;return function(_0x51313f){logger[_0x87a0('0x27')](_0x51313f[_0x87a0('0x28')]);if(_0x51313f[_0x87a0('0x29')]){delete _0x51313f[_0x87a0('0x29')];}_0xae4ee9[_0x87a0('0x1b')](_0x3c0a46)[_0x87a0('0x2a')](_0x51313f);};}exports[_0x87a0('0x2b')]=function(_0x55dbf7,_0x27ce99){var _0x24f8c0={'raw':!![],'where':{'id':_0x55dbf7[_0x87a0('0x2c')]['id']}},_0x712a00={};_0x712a00['model']=_[_0x87a0('0x2d')](db[_0x87a0('0x2e')]['rawAttributes']);_0x712a00[_0x87a0('0x2f')]=_[_0x87a0('0x2d')](_0x55dbf7[_0x87a0('0x2f')]);_0x712a00['filters']=_[_0x87a0('0x30')](_0x712a00[_0x87a0('0x31')],_0x712a00[_0x87a0('0x2f')]);_0x24f8c0[_0x87a0('0x32')]=_[_0x87a0('0x30')](_0x712a00['model'],qs[_0x87a0('0x33')](_0x55dbf7[_0x87a0('0x2f')][_0x87a0('0x33')]));_0x24f8c0[_0x87a0('0x32')]=_0x24f8c0[_0x87a0('0x32')][_0x87a0('0x34')]?_0x24f8c0[_0x87a0('0x32')]:_0x712a00[_0x87a0('0x31')];if(_0x55dbf7['query'][_0x87a0('0x35')]){_0x24f8c0[_0x87a0('0x36')]=[{'all':!![]}];}_0x24f8c0=_['merge']({},_0x24f8c0,_0x55dbf7['options']);return db['ChatProactiveAction'][_0x87a0('0x37')](_0x24f8c0)[_0x87a0('0x25')](handleEntityNotFound(_0x27ce99,null))['then'](respondWithResult(_0x27ce99,null))[_0x87a0('0x38')](handleError(_0x27ce99,null));};exports[_0x87a0('0x39')]=function(_0x105250,_0x1fbc53){return db[_0x87a0('0x2e')][_0x87a0('0x39')](_0x105250[_0x87a0('0x3a')],{})[_0x87a0('0x25')](respondWithResult(_0x1fbc53,0xc9))[_0x87a0('0x38')](handleError(_0x1fbc53,null));};exports[_0x87a0('0x3b')]=function(_0x166dec,_0x581b11){if(_0x166dec[_0x87a0('0x3a')]['id']){delete _0x166dec[_0x87a0('0x3a')]['id'];}return db[_0x87a0('0x2e')][_0x87a0('0x37')]({'where':{'id':_0x166dec[_0x87a0('0x2c')]['id']}})[_0x87a0('0x25')](handleEntityNotFound(_0x581b11,null))[_0x87a0('0x25')](saveUpdates(_0x166dec[_0x87a0('0x3a')],null))[_0x87a0('0x25')](respondWithResult(_0x581b11,null))[_0x87a0('0x38')](handleError(_0x581b11,null));};exports[_0x87a0('0x26')]=function(_0x181345,_0x1f11d1){return db['ChatProactiveAction'][_0x87a0('0x37')]({'where':{'id':_0x181345[_0x87a0('0x2c')]['id']}})[_0x87a0('0x25')](handleEntityNotFound(_0x1f11d1,null))[_0x87a0('0x25')](removeEntity(_0x1f11d1,null))['catch'](handleError(_0x1f11d1,null));};
\ No newline at end of file