Built motion from commit 10af8726.|2.6.34
[motion2.git] / server / api / chatProactiveAction / chatProactiveAction.controller.js
index e4c1916..6713aa6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf2ca=['ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','error','stack','name','send','show','params','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','model','fields','length','includeAll','include','merge','options','find','create','catch','update','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x50b1c5,_0x1cf2a9){_0x50b1c5=_0x50b1c5-0x0;var _0x344f99=_0xf2ca[_0x50b1c5];return _0x344f99;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x3c1ae6,_0xe929b5){return function(_0xff396f){if(!_0xff396f){_0x3c1ae6[_0xaf2c('0x18')](0x194);}return _0xff396f;};}function handleError(_0x4a8dd8,_0x29f8b0){_0x29f8b0=_0x29f8b0||0x1f4;return function(_0x2051be){logger[_0xaf2c('0x24')](_0x2051be[_0xaf2c('0x25')]);if(_0x2051be['name']){delete _0x2051be[_0xaf2c('0x26')];}_0x4a8dd8['status'](_0x29f8b0)[_0xaf2c('0x27')](_0x2051be);};}exports[_0xaf2c('0x28')]=function(_0x15466b,_0x5d685a){var _0x2747bb={'raw':!![],'where':{'id':_0x15466b[_0xaf2c('0x29')]['id']}},_0x2ea490={};_0x2ea490['model']=_[_0xaf2c('0x2a')](db[_0xaf2c('0x2b')][_0xaf2c('0x2c')]);_0x2ea490[_0xaf2c('0x2d')]=_['keys'](_0x15466b[_0xaf2c('0x2d')]);_0x2ea490[_0xaf2c('0x2e')]=_[_0xaf2c('0x2f')](_0x2ea490['model'],_0x2ea490['query']);_0x2747bb[_0xaf2c('0x30')]=_['intersection'](_0x2ea490[_0xaf2c('0x31')],qs['fields'](_0x15466b[_0xaf2c('0x2d')][_0xaf2c('0x32')]));_0x2747bb['attributes']=_0x2747bb[_0xaf2c('0x30')][_0xaf2c('0x33')]?_0x2747bb['attributes']:_0x2ea490[_0xaf2c('0x31')];if(_0x15466b[_0xaf2c('0x2d')][_0xaf2c('0x34')]){_0x2747bb[_0xaf2c('0x35')]=[{'all':!![]}];}_0x2747bb=_[_0xaf2c('0x36')]({},_0x2747bb,_0x15466b[_0xaf2c('0x37')]);return db['ChatProactiveAction'][_0xaf2c('0x38')](_0x2747bb)['then'](handleEntityNotFound(_0x5d685a,null))[_0xaf2c('0x23')](respondWithResult(_0x5d685a,null))['catch'](handleError(_0x5d685a,null));};exports[_0xaf2c('0x39')]=function(_0x59f686,_0x2f3d16){return db['ChatProactiveAction'][_0xaf2c('0x39')](_0x59f686['body'],{})[_0xaf2c('0x23')](respondWithResult(_0x2f3d16,0xc9))[_0xaf2c('0x3a')](handleError(_0x2f3d16,null));};exports[_0xaf2c('0x3b')]=function(_0x14ec58,_0x470aff){if(_0x14ec58['body']['id']){delete _0x14ec58['body']['id'];}return db[_0xaf2c('0x2b')][_0xaf2c('0x38')]({'where':{'id':_0x14ec58[_0xaf2c('0x29')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x470aff,null))[_0xaf2c('0x23')](saveUpdates(_0x14ec58[_0xaf2c('0x3c')],null))['then'](respondWithResult(_0x470aff,null))[_0xaf2c('0x3a')](handleError(_0x470aff,null));};exports[_0xaf2c('0x3d')]=function(_0x4fdc8b,_0x36081a){return db[_0xaf2c('0x2b')][_0xaf2c('0x38')]({'where':{'id':_0x4fdc8b[_0xaf2c('0x29')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x36081a,null))[_0xaf2c('0x23')](removeEntity(_0x36081a,null))[_0xaf2c('0x3a')](handleError(_0x36081a,null));};
\ No newline at end of file
+var _0xae53=['includeAll','include','catch','body','update','find','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','show','model','keys','ChatProactiveAction','query','filters','intersection','attributes','fields'];(function(_0x49c9eb,_0x25b227){var _0x29374c=function(_0x4c1dd7){while(--_0x4c1dd7){_0x49c9eb['push'](_0x49c9eb['shift']());}};_0x29374c(++_0x25b227);}(_0xae53,0x16e));var _0x3ae5=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xae53[_0x24f31b];return _0x488401;};'use strict';var emlformat=require(_0x3ae5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3ae5('0x1'));var jsonpatch=require(_0x3ae5('0x2'));var rp=require(_0x3ae5('0x3'));var moment=require('moment');var BPromise=require(_0x3ae5('0x4'));var Mustache=require(_0x3ae5('0x5'));var util=require(_0x3ae5('0x6'));var path=require(_0x3ae5('0x7'));var sox=require(_0x3ae5('0x8'));var csv=require('to-csv');var ejs=require(_0x3ae5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ae5('0xa'));var squel=require(_0x3ae5('0xb'));var crypto=require(_0x3ae5('0xc'));var jsforce=require(_0x3ae5('0xd'));var deskjs=require(_0x3ae5('0xe'));var toCsv=require(_0x3ae5('0xf'));var querystring=require(_0x3ae5('0x10'));var Papa=require(_0x3ae5('0x11'));var Redis=require('ioredis');var authService=require(_0x3ae5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3ae5('0x13'));var hardwareService=require(_0x3ae5('0x14'));var logger=require(_0x3ae5('0x15'))(_0x3ae5('0x16'));var utils=require(_0x3ae5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3ae5('0x18'));var db=require(_0x3ae5('0x19'))['db'];function respondWithStatusCode(_0x426238,_0x562556){_0x562556=_0x562556||0xcc;return function(_0x4a1303){if(_0x4a1303){return _0x426238[_0x3ae5('0x1a')](_0x562556);}return _0x426238['status'](_0x562556)[_0x3ae5('0x1b')]();};}function respondWithResult(_0x28c265,_0x3b9122){_0x3b9122=_0x3b9122||0xc8;return function(_0x45175c){if(_0x45175c){return _0x28c265[_0x3ae5('0x1c')](_0x3b9122)['json'](_0x45175c);}};}function respondWithFilteredResult(_0x216c62,_0x2a32a3){return function(_0xae4ddd){if(_0xae4ddd){var _0x52d14d=typeof _0x2a32a3['offset']===_0x3ae5('0x1d')&&typeof _0x2a32a3[_0x3ae5('0x1e')]===_0x3ae5('0x1d');var _0x445a31=_0xae4ddd[_0x3ae5('0x1f')];var _0xd36b7c=_0x52d14d?0x0:_0x2a32a3[_0x3ae5('0x20')];var _0x5360a3=_0x52d14d?_0xae4ddd['count']:_0x2a32a3['offset']+_0x2a32a3[_0x3ae5('0x1e')];var _0x3f43ca;if(_0x5360a3>=_0x445a31){_0x5360a3=_0x445a31;_0x3f43ca=0xc8;}else{_0x3f43ca=0xce;}_0x216c62[_0x3ae5('0x1c')](_0x3f43ca);return _0x216c62[_0x3ae5('0x21')](_0x3ae5('0x22'),_0xd36b7c+'-'+_0x5360a3+'/'+_0x445a31)[_0x3ae5('0x23')](_0xae4ddd);}return null;};}function patchUpdates(_0x1ae5e1){return function(_0x533971){try{jsonpatch[_0x3ae5('0x24')](_0x533971,_0x1ae5e1,!![]);}catch(_0x1078a0){return BPromise[_0x3ae5('0x25')](_0x1078a0);}return _0x533971[_0x3ae5('0x26')]();};}function saveUpdates(_0x36f089,_0x22cf05){return function(_0x502671){if(_0x502671){return _0x502671['update'](_0x36f089)[_0x3ae5('0x27')](function(_0x2f55a3){return _0x2f55a3;});}return null;};}function removeEntity(_0x32da8c,_0x2242cc){return function(_0x31a8bf){if(_0x31a8bf){return _0x31a8bf[_0x3ae5('0x28')]()[_0x3ae5('0x27')](function(){_0x32da8c[_0x3ae5('0x1c')](0xcc)[_0x3ae5('0x1b')]();});}};}function handleEntityNotFound(_0x4b689e,_0x7e1dd2){return function(_0x40382c){if(!_0x40382c){_0x4b689e[_0x3ae5('0x1a')](0x194);}return _0x40382c;};}function handleError(_0x478f4e,_0x8b8aa1){_0x8b8aa1=_0x8b8aa1||0x1f4;return function(_0xa8c9ac){logger[_0x3ae5('0x29')](_0xa8c9ac[_0x3ae5('0x2a')]);if(_0xa8c9ac[_0x3ae5('0x2b')]){delete _0xa8c9ac['name'];}_0x478f4e[_0x3ae5('0x1c')](_0x8b8aa1)[_0x3ae5('0x2c')](_0xa8c9ac);};}exports[_0x3ae5('0x2d')]=function(_0x41ba36,_0x17df95){var _0x12c27e={'raw':!![],'where':{'id':_0x41ba36['params']['id']}},_0x13da23={};_0x13da23[_0x3ae5('0x2e')]=_[_0x3ae5('0x2f')](db[_0x3ae5('0x30')]['rawAttributes']);_0x13da23[_0x3ae5('0x31')]=_[_0x3ae5('0x2f')](_0x41ba36[_0x3ae5('0x31')]);_0x13da23[_0x3ae5('0x32')]=_[_0x3ae5('0x33')](_0x13da23[_0x3ae5('0x2e')],_0x13da23[_0x3ae5('0x31')]);_0x12c27e[_0x3ae5('0x34')]=_['intersection'](_0x13da23[_0x3ae5('0x2e')],qs[_0x3ae5('0x35')](_0x41ba36[_0x3ae5('0x31')]['fields']));_0x12c27e[_0x3ae5('0x34')]=_0x12c27e['attributes']['length']?_0x12c27e['attributes']:_0x13da23[_0x3ae5('0x2e')];if(_0x41ba36[_0x3ae5('0x31')][_0x3ae5('0x36')]){_0x12c27e[_0x3ae5('0x37')]=[{'all':!![]}];}_0x12c27e=_['merge']({},_0x12c27e,_0x41ba36['options']);return db[_0x3ae5('0x30')]['find'](_0x12c27e)[_0x3ae5('0x27')](handleEntityNotFound(_0x17df95,null))[_0x3ae5('0x27')](respondWithResult(_0x17df95,null))[_0x3ae5('0x38')](handleError(_0x17df95,null));};exports['create']=function(_0x2228f7,_0x17d0c7){return db['ChatProactiveAction']['create'](_0x2228f7[_0x3ae5('0x39')],{})['then'](respondWithResult(_0x17d0c7,0xc9))[_0x3ae5('0x38')](handleError(_0x17d0c7,null));};exports[_0x3ae5('0x3a')]=function(_0x2bbde6,_0x1ef0f5){if(_0x2bbde6[_0x3ae5('0x39')]['id']){delete _0x2bbde6[_0x3ae5('0x39')]['id'];}return db[_0x3ae5('0x30')][_0x3ae5('0x3b')]({'where':{'id':_0x2bbde6['params']['id']}})[_0x3ae5('0x27')](handleEntityNotFound(_0x1ef0f5,null))['then'](saveUpdates(_0x2bbde6[_0x3ae5('0x39')],null))[_0x3ae5('0x27')](respondWithResult(_0x1ef0f5,null))[_0x3ae5('0x38')](handleError(_0x1ef0f5,null));};exports[_0x3ae5('0x28')]=function(_0x2c891b,_0x213f0e){return db[_0x3ae5('0x30')]['find']({'where':{'id':_0x2c891b['params']['id']}})[_0x3ae5('0x27')](handleEntityNotFound(_0x213f0e,null))['then'](removeEntity(_0x213f0e,null))[_0x3ae5('0x38')](handleError(_0x213f0e,null));};
\ No newline at end of file