Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / api / chatProactiveAction / chatProactiveAction.controller.js
index 29fea71..5846803 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7bae=['create','body','catch','params','destroy','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','show','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','model','fields','attributes','length','includeAll','merge','options','find'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7bae,0x13b));var _0xe7ba=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x7bae[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7ba('0x0'));var jsonpatch=require(_0xe7ba('0x1'));var rp=require('request-promise');var moment=require(_0xe7ba('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe7ba('0x3'));var util=require(_0xe7ba('0x4'));var path=require(_0xe7ba('0x5'));var sox=require(_0xe7ba('0x6'));var csv=require(_0xe7ba('0x7'));var ejs=require(_0xe7ba('0x8'));var fs=require('fs');var fs_extra=require(_0xe7ba('0x9'));var _=require(_0xe7ba('0xa'));var squel=require(_0xe7ba('0xb'));var crypto=require(_0xe7ba('0xc'));var jsforce=require(_0xe7ba('0xd'));var deskjs=require(_0xe7ba('0xe'));var toCsv=require(_0xe7ba('0x7'));var querystring=require(_0xe7ba('0xf'));var Papa=require('papaparse');var Redis=require(_0xe7ba('0x10'));var authService=require(_0xe7ba('0x11'));var qs=require(_0xe7ba('0x12'));var as=require(_0xe7ba('0x13'));var hardwareService=require(_0xe7ba('0x14'));var logger=require(_0xe7ba('0x15'))(_0xe7ba('0x16'));var utils=require(_0xe7ba('0x17'));var config=require(_0xe7ba('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe7ba('0x19'))['db'];function respondWithStatusCode(_0x588c8b,_0x602b1){_0x602b1=_0x602b1||0xcc;return function(_0x45229c){if(_0x45229c){return _0x588c8b[_0xe7ba('0x1a')](_0x602b1);}return _0x588c8b[_0xe7ba('0x1b')](_0x602b1)[_0xe7ba('0x1c')]();};}function respondWithResult(_0x41369f,_0x561dbb){_0x561dbb=_0x561dbb||0xc8;return function(_0x561c48){if(_0x561c48){return _0x41369f[_0xe7ba('0x1b')](_0x561dbb)[_0xe7ba('0x1d')](_0x561c48);}};}function respondWithFilteredResult(_0x359f6f,_0x5d1d03){return function(_0x4390e3){if(_0x4390e3){var _0x4b20fd=typeof _0x5d1d03['offset']==='undefined'&&typeof _0x5d1d03[_0xe7ba('0x1e')]==='undefined';var _0x41a773=_0x4390e3['count'];var _0x4e3021=_0x4b20fd?0x0:_0x5d1d03['offset'];var _0x3f326a=_0x4b20fd?_0x4390e3[_0xe7ba('0x1f')]:_0x5d1d03[_0xe7ba('0x20')]+_0x5d1d03[_0xe7ba('0x1e')];var _0x1c8b5b;if(_0x3f326a>=_0x41a773){_0x3f326a=_0x41a773;_0x1c8b5b=0xc8;}else{_0x1c8b5b=0xce;}_0x359f6f['status'](_0x1c8b5b);return _0x359f6f[_0xe7ba('0x21')](_0xe7ba('0x22'),_0x4e3021+'-'+_0x3f326a+'/'+_0x41a773)[_0xe7ba('0x1d')](_0x4390e3);}return null;};}function patchUpdates(_0x136ec6){return function(_0x4aaf35){try{jsonpatch[_0xe7ba('0x23')](_0x4aaf35,_0x136ec6,!![]);}catch(_0x2936b7){return BPromise['reject'](_0x2936b7);}return _0x4aaf35[_0xe7ba('0x24')]();};}function saveUpdates(_0x4514e8,_0x27c882){return function(_0x7ab9e4){if(_0x7ab9e4){return _0x7ab9e4[_0xe7ba('0x25')](_0x4514e8)[_0xe7ba('0x26')](function(_0x293b14){return _0x293b14;});}return null;};}function removeEntity(_0x2b29f0,_0x41cbd9){return function(_0xa72f1c){if(_0xa72f1c){return _0xa72f1c['destroy']()['then'](function(){_0x2b29f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4363a8,_0x576513){return function(_0x4ecc0d){if(!_0x4ecc0d){_0x4363a8['sendStatus'](0x194);}return _0x4ecc0d;};}function handleError(_0x255def,_0x32cc00){_0x32cc00=_0x32cc00||0x1f4;return function(_0xe32862){logger[_0xe7ba('0x27')](_0xe32862[_0xe7ba('0x28')]);if(_0xe32862[_0xe7ba('0x29')]){delete _0xe32862[_0xe7ba('0x29')];}_0x255def[_0xe7ba('0x1b')](_0x32cc00)['send'](_0xe32862);};}exports[_0xe7ba('0x2a')]=function(_0x48c869,_0x102925){var _0x92fe7={'raw':!![],'where':{'id':_0x48c869['params']['id']}},_0x369451={};_0x369451['model']=_[_0xe7ba('0x2b')](db[_0xe7ba('0x2c')][_0xe7ba('0x2d')]);_0x369451[_0xe7ba('0x2e')]=_[_0xe7ba('0x2b')](_0x48c869['query']);_0x369451[_0xe7ba('0x2f')]=_[_0xe7ba('0x30')](_0x369451['model'],_0x369451[_0xe7ba('0x2e')]);_0x92fe7['attributes']=_['intersection'](_0x369451[_0xe7ba('0x31')],qs[_0xe7ba('0x32')](_0x48c869[_0xe7ba('0x2e')]['fields']));_0x92fe7[_0xe7ba('0x33')]=_0x92fe7['attributes'][_0xe7ba('0x34')]?_0x92fe7[_0xe7ba('0x33')]:_0x369451[_0xe7ba('0x31')];if(_0x48c869[_0xe7ba('0x2e')][_0xe7ba('0x35')]){_0x92fe7['include']=[{'all':!![]}];}_0x92fe7=_[_0xe7ba('0x36')]({},_0x92fe7,_0x48c869[_0xe7ba('0x37')]);return db['ChatProactiveAction'][_0xe7ba('0x38')](_0x92fe7)[_0xe7ba('0x26')](handleEntityNotFound(_0x102925,null))[_0xe7ba('0x26')](respondWithResult(_0x102925,null))['catch'](handleError(_0x102925,null));};exports[_0xe7ba('0x39')]=function(_0x23c36e,_0x5db8ab){return db[_0xe7ba('0x2c')][_0xe7ba('0x39')](_0x23c36e[_0xe7ba('0x3a')],{})['then'](respondWithResult(_0x5db8ab,0xc9))[_0xe7ba('0x3b')](handleError(_0x5db8ab,null));};exports[_0xe7ba('0x25')]=function(_0x575f4b,_0x330e98){if(_0x575f4b[_0xe7ba('0x3a')]['id']){delete _0x575f4b[_0xe7ba('0x3a')]['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x575f4b[_0xe7ba('0x3c')]['id']}})[_0xe7ba('0x26')](handleEntityNotFound(_0x330e98,null))[_0xe7ba('0x26')](saveUpdates(_0x575f4b[_0xe7ba('0x3a')],null))[_0xe7ba('0x26')](respondWithResult(_0x330e98,null))['catch'](handleError(_0x330e98,null));};exports[_0xe7ba('0x3d')]=function(_0x2a6d2a,_0x3139a6){return db[_0xe7ba('0x2c')]['find']({'where':{'id':_0x2a6d2a[_0xe7ba('0x3c')]['id']}})[_0xe7ba('0x26')](handleEntityNotFound(_0x3139a6,null))[_0xe7ba('0x26')](removeEntity(_0x3139a6,null))[_0xe7ba('0x3b')](handleError(_0x3139a6,null));};
\ No newline at end of file
+var _0xb1a3=['limit','count','set','Content-Range','json','reject','save','then','destroy','end','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','fields','length','include','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined'];(function(_0x32189c,_0x4fa006){var _0x8da8f1=function(_0x239113){while(--_0x239113){_0x32189c['push'](_0x32189c['shift']());}};_0x8da8f1(++_0x4fa006);}(_0xb1a3,0x1cc));var _0x3b1a=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0xb1a3[_0xfcbcb8];return _0x1b1f97;};'use strict';var emlformat=require(_0x3b1a('0x0'));var rimraf=require(_0x3b1a('0x1'));var zipdir=require(_0x3b1a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b1a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3b1a('0x4'));var util=require(_0x3b1a('0x5'));var path=require(_0x3b1a('0x6'));var sox=require(_0x3b1a('0x7'));var csv=require(_0x3b1a('0x8'));var ejs=require(_0x3b1a('0x9'));var fs=require('fs');var fs_extra=require(_0x3b1a('0xa'));var _=require('lodash');var squel=require(_0x3b1a('0xb'));var crypto=require(_0x3b1a('0xc'));var jsforce=require(_0x3b1a('0xd'));var deskjs=require(_0x3b1a('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3b1a('0xf'));var Redis=require(_0x3b1a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3b1a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b1a('0x12'));var logger=require('../../config/logger')(_0x3b1a('0x13'));var utils=require(_0x3b1a('0x14'));var config=require(_0x3b1a('0x15'));var licenseUtil=require(_0x3b1a('0x16'));var db=require(_0x3b1a('0x17'))['db'];function respondWithStatusCode(_0x1fea99,_0x2bd423){_0x2bd423=_0x2bd423||0xcc;return function(_0x32e77a){if(_0x32e77a){return _0x1fea99[_0x3b1a('0x18')](_0x2bd423);}return _0x1fea99['status'](_0x2bd423)['end']();};}function respondWithResult(_0x8aad4b,_0x3dfeda){_0x3dfeda=_0x3dfeda||0xc8;return function(_0x19c135){if(_0x19c135){return _0x8aad4b[_0x3b1a('0x19')](_0x3dfeda)['json'](_0x19c135);}};}function respondWithFilteredResult(_0x1b175e,_0x2f0674){return function(_0x55ac06){if(_0x55ac06){var _0x19bbc1=typeof _0x2f0674[_0x3b1a('0x1a')]===_0x3b1a('0x1b')&&typeof _0x2f0674[_0x3b1a('0x1c')]===_0x3b1a('0x1b');var _0xf10b60=_0x55ac06[_0x3b1a('0x1d')];var _0x220869=_0x19bbc1?0x0:_0x2f0674['offset'];var _0x14996f=_0x19bbc1?_0x55ac06[_0x3b1a('0x1d')]:_0x2f0674['offset']+_0x2f0674[_0x3b1a('0x1c')];var _0x5758fd;if(_0x14996f>=_0xf10b60){_0x14996f=_0xf10b60;_0x5758fd=0xc8;}else{_0x5758fd=0xce;}_0x1b175e[_0x3b1a('0x19')](_0x5758fd);return _0x1b175e[_0x3b1a('0x1e')](_0x3b1a('0x1f'),_0x220869+'-'+_0x14996f+'/'+_0xf10b60)[_0x3b1a('0x20')](_0x55ac06);}return null;};}function patchUpdates(_0xe1113d){return function(_0x13eeec){try{jsonpatch['apply'](_0x13eeec,_0xe1113d,!![]);}catch(_0x2c0a87){return BPromise[_0x3b1a('0x21')](_0x2c0a87);}return _0x13eeec[_0x3b1a('0x22')]();};}function saveUpdates(_0x1a09f1,_0x42bdf6){return function(_0x4f5f52){if(_0x4f5f52){return _0x4f5f52['update'](_0x1a09f1)[_0x3b1a('0x23')](function(_0x447d94){return _0x447d94;});}return null;};}function removeEntity(_0x5829ea,_0x3af980){return function(_0x1728df){if(_0x1728df){return _0x1728df[_0x3b1a('0x24')]()[_0x3b1a('0x23')](function(){_0x5829ea['status'](0xcc)[_0x3b1a('0x25')]();});}};}function handleEntityNotFound(_0x417c2e,_0x2fbac5){return function(_0x482484){if(!_0x482484){_0x417c2e[_0x3b1a('0x18')](0x194);}return _0x482484;};}function handleError(_0x3744f0,_0x155d77){_0x155d77=_0x155d77||0x1f4;return function(_0x45ebfc){logger[_0x3b1a('0x26')](_0x45ebfc[_0x3b1a('0x27')]);if(_0x45ebfc['name']){delete _0x45ebfc[_0x3b1a('0x28')];}_0x3744f0[_0x3b1a('0x19')](_0x155d77)[_0x3b1a('0x29')](_0x45ebfc);};}exports[_0x3b1a('0x2a')]=function(_0x2ff415,_0x1c6399){var _0x5cb4d0={'raw':!![],'where':{'id':_0x2ff415[_0x3b1a('0x2b')]['id']}},_0x58aec7={};_0x58aec7[_0x3b1a('0x2c')]=_[_0x3b1a('0x2d')](db[_0x3b1a('0x2e')][_0x3b1a('0x2f')]);_0x58aec7[_0x3b1a('0x30')]=_[_0x3b1a('0x2d')](_0x2ff415[_0x3b1a('0x30')]);_0x58aec7[_0x3b1a('0x31')]=_['intersection'](_0x58aec7[_0x3b1a('0x2c')],_0x58aec7[_0x3b1a('0x30')]);_0x5cb4d0[_0x3b1a('0x32')]=_[_0x3b1a('0x33')](_0x58aec7[_0x3b1a('0x2c')],qs[_0x3b1a('0x34')](_0x2ff415[_0x3b1a('0x30')][_0x3b1a('0x34')]));_0x5cb4d0[_0x3b1a('0x32')]=_0x5cb4d0['attributes'][_0x3b1a('0x35')]?_0x5cb4d0[_0x3b1a('0x32')]:_0x58aec7[_0x3b1a('0x2c')];if(_0x2ff415[_0x3b1a('0x30')]['includeAll']){_0x5cb4d0[_0x3b1a('0x36')]=[{'all':!![]}];}_0x5cb4d0=_[_0x3b1a('0x37')]({},_0x5cb4d0,_0x2ff415[_0x3b1a('0x38')]);return db[_0x3b1a('0x2e')][_0x3b1a('0x39')](_0x5cb4d0)[_0x3b1a('0x23')](handleEntityNotFound(_0x1c6399,null))[_0x3b1a('0x23')](respondWithResult(_0x1c6399,null))[_0x3b1a('0x3a')](handleError(_0x1c6399,null));};exports['create']=function(_0x189e00,_0x2be45d){return db[_0x3b1a('0x2e')][_0x3b1a('0x3b')](_0x189e00[_0x3b1a('0x3c')],{})[_0x3b1a('0x23')](respondWithResult(_0x2be45d,0xc9))[_0x3b1a('0x3a')](handleError(_0x2be45d,null));};exports['update']=function(_0x3c2108,_0x420d13){if(_0x3c2108[_0x3b1a('0x3c')]['id']){delete _0x3c2108[_0x3b1a('0x3c')]['id'];}return db['ChatProactiveAction'][_0x3b1a('0x39')]({'where':{'id':_0x3c2108[_0x3b1a('0x2b')]['id']}})[_0x3b1a('0x23')](handleEntityNotFound(_0x420d13,null))[_0x3b1a('0x23')](saveUpdates(_0x3c2108[_0x3b1a('0x3c')],null))[_0x3b1a('0x23')](respondWithResult(_0x420d13,null))[_0x3b1a('0x3a')](handleError(_0x420d13,null));};exports[_0x3b1a('0x24')]=function(_0x228667,_0x5277bb){return db[_0x3b1a('0x2e')][_0x3b1a('0x39')]({'where':{'id':_0x228667['params']['id']}})[_0x3b1a('0x23')](handleEntityNotFound(_0x5277bb,null))[_0x3b1a('0x23')](removeEntity(_0x5277bb,null))[_0x3b1a('0x3a')](handleError(_0x5277bb,null));};
\ No newline at end of file