Built motion from commit da617fac.|2.6.6
[motion2.git] / server / api / chatProactiveAction / chatProactiveAction.controller.js
index 57961f9..9c6ec60 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 _0x5a01=['intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','filters'];(function(_0x2274e4,_0x5ed9e6){var _0x4d8a02=function(_0x187e19){while(--_0x187e19){_0x2274e4['push'](_0x2274e4['shift']());}};_0x4d8a02(++_0x5ed9e6);}(_0x5a01,0x1af));var _0x15a0=function(_0x5e31e2,_0x273090){_0x5e31e2=_0x5e31e2-0x0;var _0x294e2c=_0x5a01[_0x5e31e2];return _0x294e2c;};'use strict';var emlformat=require(_0x15a0('0x0'));var rimraf=require(_0x15a0('0x1'));var zipdir=require(_0x15a0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x15a0('0x3'));var BPromise=require(_0x15a0('0x4'));var Mustache=require('mustache');var util=require(_0x15a0('0x5'));var path=require(_0x15a0('0x6'));var sox=require(_0x15a0('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x15a0('0x8'));var _=require(_0x15a0('0x9'));var squel=require(_0x15a0('0xa'));var crypto=require('crypto');var jsforce=require(_0x15a0('0xb'));var deskjs=require(_0x15a0('0xc'));var toCsv=require(_0x15a0('0xd'));var querystring=require(_0x15a0('0xe'));var Papa=require(_0x15a0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x15a0('0x10'));var as=require(_0x15a0('0x11'));var hardwareService=require(_0x15a0('0x12'));var logger=require(_0x15a0('0x13'))(_0x15a0('0x14'));var utils=require(_0x15a0('0x15'));var config=require(_0x15a0('0x16'));var licenseUtil=require(_0x15a0('0x17'));var db=require(_0x15a0('0x18'))['db'];function respondWithStatusCode(_0x131ea2,_0x17108f){_0x17108f=_0x17108f||0xcc;return function(_0x418907){if(_0x418907){return _0x131ea2['sendStatus'](_0x17108f);}return _0x131ea2['status'](_0x17108f)[_0x15a0('0x19')]();};}function respondWithResult(_0x1bacb4,_0xa580bf){_0xa580bf=_0xa580bf||0xc8;return function(_0x1c4d39){if(_0x1c4d39){return _0x1bacb4[_0x15a0('0x1a')](_0xa580bf)[_0x15a0('0x1b')](_0x1c4d39);}};}function respondWithFilteredResult(_0x2595c1,_0x2568ee){return function(_0x2b8a17){if(_0x2b8a17){var _0x547d10=typeof _0x2568ee[_0x15a0('0x1c')]==='undefined'&&typeof _0x2568ee['limit']===_0x15a0('0x1d');var _0x2896bb=_0x2b8a17[_0x15a0('0x1e')];var _0x29383c=_0x547d10?0x0:_0x2568ee['offset'];var _0x5e7b01=_0x547d10?_0x2b8a17[_0x15a0('0x1e')]:_0x2568ee[_0x15a0('0x1c')]+_0x2568ee['limit'];var _0x1a71b6;if(_0x5e7b01>=_0x2896bb){_0x5e7b01=_0x2896bb;_0x1a71b6=0xc8;}else{_0x1a71b6=0xce;}_0x2595c1['status'](_0x1a71b6);return _0x2595c1[_0x15a0('0x1f')](_0x15a0('0x20'),_0x29383c+'-'+_0x5e7b01+'/'+_0x2896bb)[_0x15a0('0x1b')](_0x2b8a17);}return null;};}function patchUpdates(_0xc035d3){return function(_0x225aac){try{jsonpatch[_0x15a0('0x21')](_0x225aac,_0xc035d3,!![]);}catch(_0x43f77b){return BPromise['reject'](_0x43f77b);}return _0x225aac['save']();};}function saveUpdates(_0x32eafd,_0x23a2f6){return function(_0x349623){if(_0x349623){return _0x349623[_0x15a0('0x22')](_0x32eafd)[_0x15a0('0x23')](function(_0x3a06cc){return _0x3a06cc;});}return null;};}function removeEntity(_0x42dc91,_0x53e470){return function(_0x559024){if(_0x559024){return _0x559024[_0x15a0('0x24')]()['then'](function(){_0x42dc91[_0x15a0('0x1a')](0xcc)[_0x15a0('0x19')]();});}};}function handleEntityNotFound(_0xd7e6b3,_0x2845ec){return function(_0x23a06b){if(!_0x23a06b){_0xd7e6b3[_0x15a0('0x25')](0x194);}return _0x23a06b;};}function handleError(_0x3b050f,_0x299183){_0x299183=_0x299183||0x1f4;return function(_0x3608d6){logger[_0x15a0('0x26')](_0x3608d6[_0x15a0('0x27')]);if(_0x3608d6['name']){delete _0x3608d6[_0x15a0('0x28')];}_0x3b050f['status'](_0x299183)[_0x15a0('0x29')](_0x3608d6);};}exports['show']=function(_0x14f059,_0x192b11){var _0x1a20ed={'raw':!![],'where':{'id':_0x14f059[_0x15a0('0x2a')]['id']}},_0x15a2e7={};_0x15a2e7[_0x15a0('0x2b')]=_[_0x15a0('0x2c')](db[_0x15a0('0x2d')][_0x15a0('0x2e')]);_0x15a2e7[_0x15a0('0x2f')]=_[_0x15a0('0x2c')](_0x14f059[_0x15a0('0x2f')]);_0x15a2e7[_0x15a0('0x30')]=_[_0x15a0('0x31')](_0x15a2e7[_0x15a0('0x2b')],_0x15a2e7['query']);_0x1a20ed[_0x15a0('0x32')]=_[_0x15a0('0x31')](_0x15a2e7['model'],qs['fields'](_0x14f059[_0x15a0('0x2f')][_0x15a0('0x33')]));_0x1a20ed['attributes']=_0x1a20ed[_0x15a0('0x32')][_0x15a0('0x34')]?_0x1a20ed['attributes']:_0x15a2e7[_0x15a0('0x2b')];if(_0x14f059[_0x15a0('0x2f')][_0x15a0('0x35')]){_0x1a20ed['include']=[{'all':!![]}];}_0x1a20ed=_[_0x15a0('0x36')]({},_0x1a20ed,_0x14f059[_0x15a0('0x37')]);return db[_0x15a0('0x2d')][_0x15a0('0x38')](_0x1a20ed)['then'](handleEntityNotFound(_0x192b11,null))[_0x15a0('0x23')](respondWithResult(_0x192b11,null))[_0x15a0('0x39')](handleError(_0x192b11,null));};exports['create']=function(_0x502fc5,_0x4faadc){return db[_0x15a0('0x2d')][_0x15a0('0x3a')](_0x502fc5[_0x15a0('0x3b')],{})[_0x15a0('0x23')](respondWithResult(_0x4faadc,0xc9))[_0x15a0('0x39')](handleError(_0x4faadc,null));};exports[_0x15a0('0x22')]=function(_0x4703fe,_0x31e58d){if(_0x4703fe[_0x15a0('0x3b')]['id']){delete _0x4703fe[_0x15a0('0x3b')]['id'];}return db[_0x15a0('0x2d')][_0x15a0('0x38')]({'where':{'id':_0x4703fe[_0x15a0('0x2a')]['id']}})[_0x15a0('0x23')](handleEntityNotFound(_0x31e58d,null))[_0x15a0('0x23')](saveUpdates(_0x4703fe[_0x15a0('0x3b')],null))[_0x15a0('0x23')](respondWithResult(_0x31e58d,null))[_0x15a0('0x39')](handleError(_0x31e58d,null));};exports[_0x15a0('0x24')]=function(_0x475430,_0xe7f6bd){return db[_0x15a0('0x2d')]['find']({'where':{'id':_0x475430[_0x15a0('0x2a')]['id']}})[_0x15a0('0x23')](handleEntityNotFound(_0xe7f6bd,null))[_0x15a0('0x23')](removeEntity(_0xe7f6bd,null))[_0x15a0('0x39')](handleError(_0xe7f6bd,null));};
\ No newline at end of file