Built motion from commit a679711e.|2.6.15
[motion2.git] / server / api / chatProactiveAction / chatProactiveAction.controller.js
index 9f788d5..2ef1a1d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe64a=['length','merge','options','ChatProactiveAction','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','params','keys','query','filters','intersection','model','attributes','fields'];(function(_0x1e1962,_0x5a2061){var _0x3c06be=function(_0x37761b){while(--_0x37761b){_0x1e1962['push'](_0x1e1962['shift']());}};_0x3c06be(++_0x5a2061);}(_0xe64a,0x1e0));var _0xae64=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe64a[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0xae64('0x0'));var rimraf=require(_0xae64('0x1'));var zipdir=require(_0xae64('0x2'));var jsonpatch=require(_0xae64('0x3'));var rp=require(_0xae64('0x4'));var moment=require(_0xae64('0x5'));var BPromise=require(_0xae64('0x6'));var Mustache=require(_0xae64('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xae64('0x8'));var fs=require('fs');var fs_extra=require(_0xae64('0x9'));var _=require(_0xae64('0xa'));var squel=require(_0xae64('0xb'));var crypto=require(_0xae64('0xc'));var jsforce=require(_0xae64('0xd'));var deskjs=require(_0xae64('0xe'));var toCsv=require(_0xae64('0xf'));var querystring=require(_0xae64('0x10'));var Papa=require(_0xae64('0x11'));var Redis=require(_0xae64('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xae64('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xae64('0x14'))(_0xae64('0x15'));var utils=require(_0xae64('0x16'));var config=require(_0xae64('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xae64('0x18'))['db'];function respondWithStatusCode(_0x58d0de,_0x59b60a){_0x59b60a=_0x59b60a||0xcc;return function(_0x345caf){if(_0x345caf){return _0x58d0de[_0xae64('0x19')](_0x59b60a);}return _0x58d0de[_0xae64('0x1a')](_0x59b60a)['end']();};}function respondWithResult(_0x1247b0,_0x760b31){_0x760b31=_0x760b31||0xc8;return function(_0x306804){if(_0x306804){return _0x1247b0[_0xae64('0x1a')](_0x760b31)[_0xae64('0x1b')](_0x306804);}};}function respondWithFilteredResult(_0x4c7d1c,_0x2950c5){return function(_0x37bc58){if(_0x37bc58){var _0x717724=typeof _0x2950c5[_0xae64('0x1c')]===_0xae64('0x1d')&&typeof _0x2950c5['limit']===_0xae64('0x1d');var _0x21c285=_0x37bc58[_0xae64('0x1e')];var _0x4613d9=_0x717724?0x0:_0x2950c5[_0xae64('0x1c')];var _0x227223=_0x717724?_0x37bc58[_0xae64('0x1e')]:_0x2950c5[_0xae64('0x1c')]+_0x2950c5['limit'];var _0x3cdd98;if(_0x227223>=_0x21c285){_0x227223=_0x21c285;_0x3cdd98=0xc8;}else{_0x3cdd98=0xce;}_0x4c7d1c[_0xae64('0x1a')](_0x3cdd98);return _0x4c7d1c[_0xae64('0x1f')](_0xae64('0x20'),_0x4613d9+'-'+_0x227223+'/'+_0x21c285)[_0xae64('0x1b')](_0x37bc58);}return null;};}function patchUpdates(_0x20ca7f){return function(_0x49bab9){try{jsonpatch[_0xae64('0x21')](_0x49bab9,_0x20ca7f,!![]);}catch(_0x4a4c4e){return BPromise[_0xae64('0x22')](_0x4a4c4e);}return _0x49bab9[_0xae64('0x23')]();};}function saveUpdates(_0x12d94d,_0x394afa){return function(_0x4406dc){if(_0x4406dc){return _0x4406dc[_0xae64('0x24')](_0x12d94d)[_0xae64('0x25')](function(_0x127ae2){return _0x127ae2;});}return null;};}function removeEntity(_0x24a35f,_0x2e6852){return function(_0x131225){if(_0x131225){return _0x131225[_0xae64('0x26')]()[_0xae64('0x25')](function(){_0x24a35f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6eb56,_0xd5ecaf){return function(_0x22d91a){if(!_0x22d91a){_0x6eb56[_0xae64('0x19')](0x194);}return _0x22d91a;};}function handleError(_0x4d987f,_0x518969){_0x518969=_0x518969||0x1f4;return function(_0x562c2d){logger[_0xae64('0x27')](_0x562c2d[_0xae64('0x28')]);if(_0x562c2d['name']){delete _0x562c2d[_0xae64('0x29')];}_0x4d987f[_0xae64('0x1a')](_0x518969)[_0xae64('0x2a')](_0x562c2d);};}exports['show']=function(_0x3b946c,_0x562eb4){var _0x55f53d={'raw':!![],'where':{'id':_0x3b946c[_0xae64('0x2b')]['id']}},_0x5e4b2c={};_0x5e4b2c['model']=_[_0xae64('0x2c')](db['ChatProactiveAction']['rawAttributes']);_0x5e4b2c['query']=_[_0xae64('0x2c')](_0x3b946c[_0xae64('0x2d')]);_0x5e4b2c[_0xae64('0x2e')]=_[_0xae64('0x2f')](_0x5e4b2c[_0xae64('0x30')],_0x5e4b2c[_0xae64('0x2d')]);_0x55f53d[_0xae64('0x31')]=_[_0xae64('0x2f')](_0x5e4b2c[_0xae64('0x30')],qs['fields'](_0x3b946c[_0xae64('0x2d')][_0xae64('0x32')]));_0x55f53d[_0xae64('0x31')]=_0x55f53d[_0xae64('0x31')][_0xae64('0x33')]?_0x55f53d[_0xae64('0x31')]:_0x5e4b2c['model'];if(_0x3b946c[_0xae64('0x2d')]['includeAll']){_0x55f53d['include']=[{'all':!![]}];}_0x55f53d=_[_0xae64('0x34')]({},_0x55f53d,_0x3b946c[_0xae64('0x35')]);return db[_0xae64('0x36')][_0xae64('0x37')](_0x55f53d)[_0xae64('0x25')](handleEntityNotFound(_0x562eb4,null))[_0xae64('0x25')](respondWithResult(_0x562eb4,null))[_0xae64('0x38')](handleError(_0x562eb4,null));};exports['create']=function(_0xe53734,_0x4437e9){return db[_0xae64('0x36')][_0xae64('0x39')](_0xe53734[_0xae64('0x3a')],{})[_0xae64('0x25')](respondWithResult(_0x4437e9,0xc9))['catch'](handleError(_0x4437e9,null));};exports[_0xae64('0x24')]=function(_0x28269b,_0x3afc79){if(_0x28269b[_0xae64('0x3a')]['id']){delete _0x28269b['body']['id'];}return db[_0xae64('0x36')][_0xae64('0x37')]({'where':{'id':_0x28269b['params']['id']}})[_0xae64('0x25')](handleEntityNotFound(_0x3afc79,null))[_0xae64('0x25')](saveUpdates(_0x28269b['body'],null))[_0xae64('0x25')](respondWithResult(_0x3afc79,null))[_0xae64('0x38')](handleError(_0x3afc79,null));};exports[_0xae64('0x26')]=function(_0x19a5b7,_0x4c55b3){return db[_0xae64('0x36')][_0xae64('0x37')]({'where':{'id':_0x19a5b7[_0xae64('0x2b')]['id']}})[_0xae64('0x25')](handleEntityNotFound(_0x4c55b3,null))[_0xae64('0x25')](removeEntity(_0x4c55b3,null))[_0xae64('0x38')](handleError(_0x4c55b3,null));};
\ No newline at end of file
+var _0x7c49=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','update','then','destroy','error','stack','name','send','show','model','keys','query','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','params','eml-format','rimraf','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x3dfba9,_0x239672){var _0x227379=function(_0x5b0254){while(--_0x5b0254){_0x3dfba9['push'](_0x3dfba9['shift']());}};_0x227379(++_0x239672);}(_0x7c49,0x141));var _0x97c4=function(_0x171ca1,_0x503c37){_0x171ca1=_0x171ca1-0x0;var _0x53de15=_0x7c49[_0x171ca1];return _0x53de15;};'use strict';var emlformat=require(_0x97c4('0x0'));var rimraf=require(_0x97c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x97c4('0x2'));var moment=require('moment');var BPromise=require(_0x97c4('0x3'));var Mustache=require(_0x97c4('0x4'));var util=require('util');var path=require('path');var sox=require(_0x97c4('0x5'));var csv=require(_0x97c4('0x6'));var ejs=require(_0x97c4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97c4('0x8'));var squel=require(_0x97c4('0x9'));var crypto=require(_0x97c4('0xa'));var jsforce=require(_0x97c4('0xb'));var deskjs=require(_0x97c4('0xc'));var toCsv=require(_0x97c4('0x6'));var querystring=require(_0x97c4('0xd'));var Papa=require(_0x97c4('0xe'));var Redis=require(_0x97c4('0xf'));var authService=require(_0x97c4('0x10'));var qs=require(_0x97c4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x97c4('0x12'))(_0x97c4('0x13'));var utils=require('../../config/utils');var config=require(_0x97c4('0x14'));var licenseUtil=require(_0x97c4('0x15'));var db=require(_0x97c4('0x16'))['db'];function respondWithStatusCode(_0x5bd0a2,_0x4e5e98){_0x4e5e98=_0x4e5e98||0xcc;return function(_0x1f16cc){if(_0x1f16cc){return _0x5bd0a2[_0x97c4('0x17')](_0x4e5e98);}return _0x5bd0a2['status'](_0x4e5e98)[_0x97c4('0x18')]();};}function respondWithResult(_0x519188,_0xbd9965){_0xbd9965=_0xbd9965||0xc8;return function(_0x37b746){if(_0x37b746){return _0x519188[_0x97c4('0x19')](_0xbd9965)[_0x97c4('0x1a')](_0x37b746);}};}function respondWithFilteredResult(_0x94f8ed,_0x3434ee){return function(_0x50d8ad){if(_0x50d8ad){var _0x1fff7e=typeof _0x3434ee['offset']===_0x97c4('0x1b')&&typeof _0x3434ee[_0x97c4('0x1c')]===_0x97c4('0x1b');var _0x1f178b=_0x50d8ad[_0x97c4('0x1d')];var _0x142f94=_0x1fff7e?0x0:_0x3434ee[_0x97c4('0x1e')];var _0x1ce103=_0x1fff7e?_0x50d8ad[_0x97c4('0x1d')]:_0x3434ee[_0x97c4('0x1e')]+_0x3434ee['limit'];var _0x317916;if(_0x1ce103>=_0x1f178b){_0x1ce103=_0x1f178b;_0x317916=0xc8;}else{_0x317916=0xce;}_0x94f8ed[_0x97c4('0x19')](_0x317916);return _0x94f8ed[_0x97c4('0x1f')]('Content-Range',_0x142f94+'-'+_0x1ce103+'/'+_0x1f178b)[_0x97c4('0x1a')](_0x50d8ad);}return null;};}function patchUpdates(_0x222ba2){return function(_0x288284){try{jsonpatch['apply'](_0x288284,_0x222ba2,!![]);}catch(_0x511947){return BPromise['reject'](_0x511947);}return _0x288284['save']();};}function saveUpdates(_0x3373f8,_0x3447fc){return function(_0x40859){if(_0x40859){return _0x40859[_0x97c4('0x20')](_0x3373f8)[_0x97c4('0x21')](function(_0x8e8544){return _0x8e8544;});}return null;};}function removeEntity(_0x2ca647,_0x3c00aa){return function(_0x42abf6){if(_0x42abf6){return _0x42abf6[_0x97c4('0x22')]()[_0x97c4('0x21')](function(){_0x2ca647[_0x97c4('0x19')](0xcc)[_0x97c4('0x18')]();});}};}function handleEntityNotFound(_0x4afb57,_0x3da867){return function(_0x15a15f){if(!_0x15a15f){_0x4afb57[_0x97c4('0x17')](0x194);}return _0x15a15f;};}function handleError(_0x58f724,_0x2daa91){_0x2daa91=_0x2daa91||0x1f4;return function(_0x531c31){logger[_0x97c4('0x23')](_0x531c31[_0x97c4('0x24')]);if(_0x531c31[_0x97c4('0x25')]){delete _0x531c31[_0x97c4('0x25')];}_0x58f724[_0x97c4('0x19')](_0x2daa91)[_0x97c4('0x26')](_0x531c31);};}exports[_0x97c4('0x27')]=function(_0x38cb3f,_0x174be5){var _0x3c4323={'raw':!![],'where':{'id':_0x38cb3f['params']['id']}},_0x3bc0d2={};_0x3bc0d2[_0x97c4('0x28')]=_[_0x97c4('0x29')](db['ChatProactiveAction']['rawAttributes']);_0x3bc0d2[_0x97c4('0x2a')]=_['keys'](_0x38cb3f[_0x97c4('0x2a')]);_0x3bc0d2['filters']=_[_0x97c4('0x2b')](_0x3bc0d2[_0x97c4('0x28')],_0x3bc0d2[_0x97c4('0x2a')]);_0x3c4323[_0x97c4('0x2c')]=_[_0x97c4('0x2b')](_0x3bc0d2[_0x97c4('0x28')],qs[_0x97c4('0x2d')](_0x38cb3f[_0x97c4('0x2a')][_0x97c4('0x2d')]));_0x3c4323['attributes']=_0x3c4323['attributes'][_0x97c4('0x2e')]?_0x3c4323[_0x97c4('0x2c')]:_0x3bc0d2[_0x97c4('0x28')];if(_0x38cb3f[_0x97c4('0x2a')][_0x97c4('0x2f')]){_0x3c4323[_0x97c4('0x30')]=[{'all':!![]}];}_0x3c4323=_[_0x97c4('0x31')]({},_0x3c4323,_0x38cb3f[_0x97c4('0x32')]);return db['ChatProactiveAction'][_0x97c4('0x33')](_0x3c4323)[_0x97c4('0x21')](handleEntityNotFound(_0x174be5,null))[_0x97c4('0x21')](respondWithResult(_0x174be5,null))[_0x97c4('0x34')](handleError(_0x174be5,null));};exports[_0x97c4('0x35')]=function(_0x2d391d,_0x329d7e){return db['ChatProactiveAction'][_0x97c4('0x35')](_0x2d391d['body'],{})['then'](respondWithResult(_0x329d7e,0xc9))[_0x97c4('0x34')](handleError(_0x329d7e,null));};exports[_0x97c4('0x20')]=function(_0xaecbd8,_0x19334a){if(_0xaecbd8[_0x97c4('0x36')]['id']){delete _0xaecbd8['body']['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0xaecbd8['params']['id']}})[_0x97c4('0x21')](handleEntityNotFound(_0x19334a,null))[_0x97c4('0x21')](saveUpdates(_0xaecbd8[_0x97c4('0x36')],null))[_0x97c4('0x21')](respondWithResult(_0x19334a,null))[_0x97c4('0x34')](handleError(_0x19334a,null));};exports[_0x97c4('0x22')]=function(_0x1b442b,_0x4f14c7){return db['ChatProactiveAction'][_0x97c4('0x33')]({'where':{'id':_0x1b442b[_0x97c4('0x37')]['id']}})['then'](handleEntityNotFound(_0x4f14c7,null))[_0x97c4('0x21')](removeEntity(_0x4f14c7,null))['catch'](handleError(_0x4f14c7,null));};
\ No newline at end of file