Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / api / chatProactiveAction / chatProactiveAction.controller.js
index b903679..25de7a0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4c0e=['../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','save','destroy','then','error','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','create','catch','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x5b01b8,_0x312ec2){var _0x2b032d=function(_0x59eb7d){while(--_0x59eb7d){_0x5b01b8['push'](_0x5b01b8['shift']());}};_0x2b032d(++_0x312ec2);}(_0x4c0e,0x10e));var _0xe4c0=function(_0xe47217,_0x3a35db){_0xe47217=_0xe47217-0x0;var _0x3dc84c=_0x4c0e[_0xe47217];return _0x3dc84c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe4c0('0x0'));var rimraf=require(_0xe4c0('0x1'));var zipdir=require(_0xe4c0('0x2'));var jsonpatch=require(_0xe4c0('0x3'));var rp=require('request-promise');var moment=require(_0xe4c0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe4c0('0x5'));var sox=require(_0xe4c0('0x6'));var csv=require(_0xe4c0('0x7'));var ejs=require(_0xe4c0('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe4c0('0x9'));var crypto=require(_0xe4c0('0xa'));var jsforce=require(_0xe4c0('0xb'));var deskjs=require(_0xe4c0('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe4c0('0xd'));var Papa=require(_0xe4c0('0xe'));var Redis=require('ioredis');var authService=require(_0xe4c0('0xf'));var qs=require(_0xe4c0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe4c0('0x11'))(_0xe4c0('0x12'));var utils=require(_0xe4c0('0x13'));var config=require(_0xe4c0('0x14'));var licenseUtil=require(_0xe4c0('0x15'));var db=require(_0xe4c0('0x16'))['db'];function respondWithStatusCode(_0x5efa52,_0x43d9b5){_0x43d9b5=_0x43d9b5||0xcc;return function(_0xe2db20){if(_0xe2db20){return _0x5efa52[_0xe4c0('0x17')](_0x43d9b5);}return _0x5efa52[_0xe4c0('0x18')](_0x43d9b5)[_0xe4c0('0x19')]();};}function respondWithResult(_0x221006,_0x38926b){_0x38926b=_0x38926b||0xc8;return function(_0x2f00a7){if(_0x2f00a7){return _0x221006[_0xe4c0('0x18')](_0x38926b)[_0xe4c0('0x1a')](_0x2f00a7);}};}function respondWithFilteredResult(_0x348ce0,_0x52886f){return function(_0x19017b){if(_0x19017b){var _0x223e17=_0x19017b['count'],_0x3a4424=_0x52886f[_0xe4c0('0x1b')],_0x5c0bae=_0x52886f[_0xe4c0('0x1b')]+_0x52886f[_0xe4c0('0x1c')],_0x55bf92;if(_0x5c0bae>=_0x223e17){_0x5c0bae=_0x223e17;_0x55bf92=0xc8;}else{_0x55bf92=0xce;}_0x348ce0['status'](_0x55bf92);return _0x348ce0[_0xe4c0('0x1d')]('Content-Range',_0x3a4424+'-'+_0x5c0bae+'/'+_0x223e17)[_0xe4c0('0x1a')](_0x19017b);}return null;};}function patchUpdates(_0x358d36){return function(_0x18df5e){try{jsonpatch[_0xe4c0('0x1e')](_0x18df5e,_0x358d36,!![]);}catch(_0x3b3608){return BPromise['reject'](_0x3b3608);}return _0x18df5e[_0xe4c0('0x1f')]();};}function saveUpdates(_0x4bc463,_0xaaab97){return function(_0x376be3){if(_0x376be3){return _0x376be3['update'](_0x4bc463)['then'](function(_0x25d4f0){return _0x25d4f0;});}return null;};}function removeEntity(_0x38be38,_0x2cf315){return function(_0x4fb2a4){if(_0x4fb2a4){return _0x4fb2a4[_0xe4c0('0x20')]()[_0xe4c0('0x21')](function(){_0x38be38[_0xe4c0('0x18')](0xcc)[_0xe4c0('0x19')]();});}};}function handleEntityNotFound(_0x4cc70d,_0x1c0864){return function(_0x4e9c4d){if(!_0x4e9c4d){_0x4cc70d[_0xe4c0('0x17')](0x194);}return _0x4e9c4d;};}function handleError(_0x40224c,_0x2c53ca){_0x2c53ca=_0x2c53ca||0x1f4;return function(_0x1c6e75){logger[_0xe4c0('0x22')](_0x1c6e75[_0xe4c0('0x23')]);if(_0x1c6e75[_0xe4c0('0x24')]){delete _0x1c6e75['name'];}_0x40224c[_0xe4c0('0x18')](_0x2c53ca)[_0xe4c0('0x25')](_0x1c6e75);};}exports['show']=function(_0x313feb,_0x2f1521){var _0x32b6f2={'raw':!![],'where':{'id':_0x313feb[_0xe4c0('0x26')]['id']}},_0x8f546e={};_0x8f546e[_0xe4c0('0x27')]=_[_0xe4c0('0x28')](db[_0xe4c0('0x29')][_0xe4c0('0x2a')]);_0x8f546e[_0xe4c0('0x2b')]=_[_0xe4c0('0x28')](_0x313feb[_0xe4c0('0x2b')]);_0x8f546e[_0xe4c0('0x2c')]=_[_0xe4c0('0x2d')](_0x8f546e[_0xe4c0('0x27')],_0x8f546e[_0xe4c0('0x2b')]);_0x32b6f2[_0xe4c0('0x2e')]=_[_0xe4c0('0x2d')](_0x8f546e[_0xe4c0('0x27')],qs['fields'](_0x313feb[_0xe4c0('0x2b')][_0xe4c0('0x2f')]));_0x32b6f2['attributes']=_0x32b6f2['attributes'][_0xe4c0('0x30')]?_0x32b6f2['attributes']:_0x8f546e[_0xe4c0('0x27')];if(_0x313feb[_0xe4c0('0x2b')][_0xe4c0('0x31')]){_0x32b6f2[_0xe4c0('0x32')]=[{'all':!![]}];}_0x32b6f2=_['merge']({},_0x32b6f2,_0x313feb[_0xe4c0('0x33')]);return db['ChatProactiveAction']['find'](_0x32b6f2)[_0xe4c0('0x21')](handleEntityNotFound(_0x2f1521,null))['then'](respondWithResult(_0x2f1521,null))['catch'](handleError(_0x2f1521,null));};exports['create']=function(_0x302802,_0x40baa1){return db['ChatProactiveAction'][_0xe4c0('0x34')](_0x302802['body'],{})[_0xe4c0('0x21')](respondWithResult(_0x40baa1,0xc9))[_0xe4c0('0x35')](handleError(_0x40baa1,null));};exports[_0xe4c0('0x36')]=function(_0x160f6a,_0xb73017){if(_0x160f6a['body']['id']){delete _0x160f6a[_0xe4c0('0x37')]['id'];}return db['ChatProactiveAction'][_0xe4c0('0x38')]({'where':{'id':_0x160f6a[_0xe4c0('0x26')]['id']}})[_0xe4c0('0x21')](handleEntityNotFound(_0xb73017,null))[_0xe4c0('0x21')](saveUpdates(_0x160f6a['body'],null))['then'](respondWithResult(_0xb73017,null))[_0xe4c0('0x35')](handleError(_0xb73017,null));};exports[_0xe4c0('0x20')]=function(_0x13a75c,_0x357212){return db[_0xe4c0('0x29')]['find']({'where':{'id':_0x13a75c[_0xe4c0('0x26')]['id']}})['then'](handleEntityNotFound(_0x357212,null))[_0xe4c0('0x21')](removeEntity(_0x357212,null))[_0xe4c0('0x35')](handleError(_0x357212,null));};
\ No newline at end of file
+var _0x6fc4=['update','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','query','filters','intersection','attributes','fields','includeAll','merge','options','find','catch','create','body','eml-format','rimraf','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x6fc4,0x1a0));var _0x46fc=function(_0x3e18bf,_0x387f5e){_0x3e18bf=_0x3e18bf-0x0;var _0x1022e5=_0x6fc4[_0x3e18bf];return _0x1022e5;};'use strict';var emlformat=require(_0x46fc('0x0'));var rimraf=require(_0x46fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x46fc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x46fc('0x3'));var path=require(_0x46fc('0x4'));var sox=require(_0x46fc('0x5'));var csv=require(_0x46fc('0x6'));var ejs=require(_0x46fc('0x7'));var fs=require('fs');var fs_extra=require(_0x46fc('0x8'));var _=require(_0x46fc('0x9'));var squel=require(_0x46fc('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x46fc('0xb'));var toCsv=require(_0x46fc('0x6'));var querystring=require(_0x46fc('0xc'));var Papa=require(_0x46fc('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x46fc('0xe'));var as=require(_0x46fc('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46fc('0x10'))('api');var utils=require(_0x46fc('0x11'));var config=require(_0x46fc('0x12'));var licenseUtil=require(_0x46fc('0x13'));var db=require(_0x46fc('0x14'))['db'];function respondWithStatusCode(_0x317f01,_0x36ec39){_0x36ec39=_0x36ec39||0xcc;return function(_0x1013ae){if(_0x1013ae){return _0x317f01[_0x46fc('0x15')](_0x36ec39);}return _0x317f01[_0x46fc('0x16')](_0x36ec39)[_0x46fc('0x17')]();};}function respondWithResult(_0x34a019,_0x403564){_0x403564=_0x403564||0xc8;return function(_0x36f17c){if(_0x36f17c){return _0x34a019[_0x46fc('0x16')](_0x403564)[_0x46fc('0x18')](_0x36f17c);}};}function respondWithFilteredResult(_0x39aa74,_0x246499){return function(_0x67f365){if(_0x67f365){var _0x51ab37=typeof _0x246499[_0x46fc('0x19')]===_0x46fc('0x1a')&&typeof _0x246499[_0x46fc('0x1b')]===_0x46fc('0x1a');var _0xd40ad2=_0x67f365['count'];var _0x23b041=_0x51ab37?0x0:_0x246499[_0x46fc('0x19')];var _0x2ebd06=_0x51ab37?_0x67f365[_0x46fc('0x1c')]:_0x246499[_0x46fc('0x19')]+_0x246499[_0x46fc('0x1b')];var _0x5d168a;if(_0x2ebd06>=_0xd40ad2){_0x2ebd06=_0xd40ad2;_0x5d168a=0xc8;}else{_0x5d168a=0xce;}_0x39aa74[_0x46fc('0x16')](_0x5d168a);return _0x39aa74['set'](_0x46fc('0x1d'),_0x23b041+'-'+_0x2ebd06+'/'+_0xd40ad2)[_0x46fc('0x18')](_0x67f365);}return null;};}function patchUpdates(_0x1e6f26){return function(_0x126bf1){try{jsonpatch['apply'](_0x126bf1,_0x1e6f26,!![]);}catch(_0x568f87){return BPromise[_0x46fc('0x1e')](_0x568f87);}return _0x126bf1[_0x46fc('0x1f')]();};}function saveUpdates(_0x1bbc88,_0x48d00f){return function(_0x483acf){if(_0x483acf){return _0x483acf[_0x46fc('0x20')](_0x1bbc88)[_0x46fc('0x21')](function(_0x5b8731){return _0x5b8731;});}return null;};}function removeEntity(_0x720693,_0x9cbc15){return function(_0x372c6f){if(_0x372c6f){return _0x372c6f[_0x46fc('0x22')]()[_0x46fc('0x21')](function(){_0x720693[_0x46fc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16a8e3,_0x352c0f){return function(_0x4f8ad7){if(!_0x4f8ad7){_0x16a8e3[_0x46fc('0x15')](0x194);}return _0x4f8ad7;};}function handleError(_0x28f575,_0x5d5bcc){_0x5d5bcc=_0x5d5bcc||0x1f4;return function(_0x4442f0){logger[_0x46fc('0x23')](_0x4442f0[_0x46fc('0x24')]);if(_0x4442f0[_0x46fc('0x25')]){delete _0x4442f0[_0x46fc('0x25')];}_0x28f575[_0x46fc('0x16')](_0x5d5bcc)[_0x46fc('0x26')](_0x4442f0);};}exports[_0x46fc('0x27')]=function(_0x448f91,_0x29e78d){var _0x3591f9={'raw':!![],'where':{'id':_0x448f91[_0x46fc('0x28')]['id']}},_0x38f8f5={};_0x38f8f5[_0x46fc('0x29')]=_[_0x46fc('0x2a')](db[_0x46fc('0x2b')]['rawAttributes']);_0x38f8f5[_0x46fc('0x2c')]=_[_0x46fc('0x2a')](_0x448f91[_0x46fc('0x2c')]);_0x38f8f5[_0x46fc('0x2d')]=_[_0x46fc('0x2e')](_0x38f8f5[_0x46fc('0x29')],_0x38f8f5['query']);_0x3591f9[_0x46fc('0x2f')]=_[_0x46fc('0x2e')](_0x38f8f5[_0x46fc('0x29')],qs[_0x46fc('0x30')](_0x448f91[_0x46fc('0x2c')][_0x46fc('0x30')]));_0x3591f9[_0x46fc('0x2f')]=_0x3591f9['attributes']['length']?_0x3591f9[_0x46fc('0x2f')]:_0x38f8f5[_0x46fc('0x29')];if(_0x448f91[_0x46fc('0x2c')][_0x46fc('0x31')]){_0x3591f9['include']=[{'all':!![]}];}_0x3591f9=_[_0x46fc('0x32')]({},_0x3591f9,_0x448f91[_0x46fc('0x33')]);return db[_0x46fc('0x2b')][_0x46fc('0x34')](_0x3591f9)[_0x46fc('0x21')](handleEntityNotFound(_0x29e78d,null))[_0x46fc('0x21')](respondWithResult(_0x29e78d,null))[_0x46fc('0x35')](handleError(_0x29e78d,null));};exports[_0x46fc('0x36')]=function(_0x1d075e,_0x1efc32){return db['ChatProactiveAction'][_0x46fc('0x36')](_0x1d075e[_0x46fc('0x37')],{})[_0x46fc('0x21')](respondWithResult(_0x1efc32,0xc9))[_0x46fc('0x35')](handleError(_0x1efc32,null));};exports[_0x46fc('0x20')]=function(_0xa85ff6,_0x5bc0e4){if(_0xa85ff6[_0x46fc('0x37')]['id']){delete _0xa85ff6[_0x46fc('0x37')]['id'];}return db[_0x46fc('0x2b')]['find']({'where':{'id':_0xa85ff6[_0x46fc('0x28')]['id']}})[_0x46fc('0x21')](handleEntityNotFound(_0x5bc0e4,null))[_0x46fc('0x21')](saveUpdates(_0xa85ff6[_0x46fc('0x37')],null))[_0x46fc('0x21')](respondWithResult(_0x5bc0e4,null))[_0x46fc('0x35')](handleError(_0x5bc0e4,null));};exports['destroy']=function(_0x272595,_0x3dac4d){return db[_0x46fc('0x2b')][_0x46fc('0x34')]({'where':{'id':_0x272595['params']['id']}})[_0x46fc('0x21')](handleEntityNotFound(_0x3dac4d,null))[_0x46fc('0x21')](removeEntity(_0x3dac4d,null))[_0x46fc('0x35')](handleError(_0x3dac4d,null));};
\ No newline at end of file