Built motion from commit (unavailable).|2.5.16
[motion2.git] / server / api / chatProactiveAction / chatProactiveAction.controller.js
index 5f58e81..110bc36 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x91e8=['create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','set','Content-Range','json','reject','save','update','destroy','then','sendStatus','error','stack','name','send','show','model','keys','query','filters','intersection','fields','attributes','includeAll','include','merge','options','ChatProactiveAction','find','catch'];(function(_0x230ca1,_0x311216){var _0x3370e9=function(_0x324936){while(--_0x324936){_0x230ca1['push'](_0x230ca1['shift']());}};_0x3370e9(++_0x311216);}(_0x91e8,0xef));var _0x891e=function(_0xc72875,_0x59d113){_0xc72875=_0xc72875-0x0;var _0x29e61c=_0x91e8[_0xc72875];return _0x29e61c;};'use strict';var pdf=require(_0x891e('0x0'));var emlformat=require(_0x891e('0x1'));var rimraf=require(_0x891e('0x2'));var zipdir=require(_0x891e('0x3'));var jsonpatch=require(_0x891e('0x4'));var rp=require('request-promise');var moment=require(_0x891e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x891e('0x6'));var util=require(_0x891e('0x7'));var path=require(_0x891e('0x8'));var sox=require(_0x891e('0x9'));var csv=require(_0x891e('0xa'));var ejs=require(_0x891e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x891e('0xc'));var jsforce=require(_0x891e('0xd'));var deskjs=require(_0x891e('0xe'));var toCsv=require(_0x891e('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x891e('0xf'));var authService=require(_0x891e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x891e('0x11'));var hardwareService=require(_0x891e('0x12'));var logger=require('../../config/logger')(_0x891e('0x13'));var utils=require(_0x891e('0x14'));var config=require(_0x891e('0x15'));var licenseUtil=require(_0x891e('0x16'));var db=require(_0x891e('0x17'))['db'];function respondWithStatusCode(_0x259fe2,_0x52944d){_0x52944d=_0x52944d||0xcc;return function(_0x28dc84){if(_0x28dc84){return _0x259fe2['sendStatus'](_0x52944d);}return _0x259fe2[_0x891e('0x18')](_0x52944d)[_0x891e('0x19')]();};}function respondWithResult(_0x253eaa,_0x376725){_0x376725=_0x376725||0xc8;return function(_0x13bbc9){if(_0x13bbc9){return _0x253eaa[_0x891e('0x18')](_0x376725)['json'](_0x13bbc9);}};}function respondWithFilteredResult(_0x3886d1,_0x3f1cd8){return function(_0x15b729){if(_0x15b729){var _0x2ef997=_0x15b729[_0x891e('0x1a')],_0x1d9cf0=_0x3f1cd8[_0x891e('0x1b')],_0x321e6a=_0x3f1cd8[_0x891e('0x1b')]+_0x3f1cd8['limit'],_0x2731b1;if(_0x321e6a>=_0x2ef997){_0x321e6a=_0x2ef997;_0x2731b1=0xc8;}else{_0x2731b1=0xce;}_0x3886d1[_0x891e('0x18')](_0x2731b1);return _0x3886d1[_0x891e('0x1c')](_0x891e('0x1d'),_0x1d9cf0+'-'+_0x321e6a+'/'+_0x2ef997)[_0x891e('0x1e')](_0x15b729);}return null;};}function patchUpdates(_0x55624d){return function(_0x1deb3f){try{jsonpatch['apply'](_0x1deb3f,_0x55624d,!![]);}catch(_0x144481){return BPromise[_0x891e('0x1f')](_0x144481);}return _0x1deb3f[_0x891e('0x20')]();};}function saveUpdates(_0x480a17,_0x51ea3a){return function(_0xc3f0d5){if(_0xc3f0d5){return _0xc3f0d5[_0x891e('0x21')](_0x480a17)['then'](function(_0xac221e){return _0xac221e;});}return null;};}function removeEntity(_0x2d934e,_0x4f1846){return function(_0x2f6717){if(_0x2f6717){return _0x2f6717[_0x891e('0x22')]()[_0x891e('0x23')](function(){_0x2d934e[_0x891e('0x18')](0xcc)[_0x891e('0x19')]();});}};}function handleEntityNotFound(_0x5051b7,_0x4ce8de){return function(_0x31a123){if(!_0x31a123){_0x5051b7[_0x891e('0x24')](0x194);}return _0x31a123;};}function handleError(_0x42ced2,_0x26423b){_0x26423b=_0x26423b||0x1f4;return function(_0x36a4f8){logger[_0x891e('0x25')](_0x36a4f8[_0x891e('0x26')]);if(_0x36a4f8[_0x891e('0x27')]){delete _0x36a4f8[_0x891e('0x27')];}_0x42ced2[_0x891e('0x18')](_0x26423b)[_0x891e('0x28')](_0x36a4f8);};}exports[_0x891e('0x29')]=function(_0x2e3964,_0x3f533c){var _0x51ac49={'raw':!![],'where':{'id':_0x2e3964['params']['id']}},_0x118e6c={};_0x118e6c[_0x891e('0x2a')]=_[_0x891e('0x2b')](db['ChatProactiveAction']['rawAttributes']);_0x118e6c[_0x891e('0x2c')]=_[_0x891e('0x2b')](_0x2e3964[_0x891e('0x2c')]);_0x118e6c[_0x891e('0x2d')]=_['intersection'](_0x118e6c[_0x891e('0x2a')],_0x118e6c[_0x891e('0x2c')]);_0x51ac49['attributes']=_[_0x891e('0x2e')](_0x118e6c[_0x891e('0x2a')],qs[_0x891e('0x2f')](_0x2e3964[_0x891e('0x2c')][_0x891e('0x2f')]));_0x51ac49[_0x891e('0x30')]=_0x51ac49[_0x891e('0x30')]['length']?_0x51ac49[_0x891e('0x30')]:_0x118e6c[_0x891e('0x2a')];if(_0x2e3964['query'][_0x891e('0x31')]){_0x51ac49[_0x891e('0x32')]=[{'all':!![]}];}_0x51ac49=_[_0x891e('0x33')]({},_0x51ac49,_0x2e3964[_0x891e('0x34')]);return db[_0x891e('0x35')][_0x891e('0x36')](_0x51ac49)[_0x891e('0x23')](handleEntityNotFound(_0x3f533c,null))['then'](respondWithResult(_0x3f533c,null))[_0x891e('0x37')](handleError(_0x3f533c,null));};exports[_0x891e('0x38')]=function(_0x431473,_0x559b5b){return db['ChatProactiveAction'][_0x891e('0x38')](_0x431473[_0x891e('0x39')],{})[_0x891e('0x23')](respondWithResult(_0x559b5b,0xc9))['catch'](handleError(_0x559b5b,null));};exports[_0x891e('0x21')]=function(_0x516ea8,_0x2b3239){if(_0x516ea8['body']['id']){delete _0x516ea8['body']['id'];}return db[_0x891e('0x35')][_0x891e('0x36')]({'where':{'id':_0x516ea8[_0x891e('0x3a')]['id']}})[_0x891e('0x23')](handleEntityNotFound(_0x2b3239,null))[_0x891e('0x23')](saveUpdates(_0x516ea8[_0x891e('0x39')],null))['then'](respondWithResult(_0x2b3239,null))[_0x891e('0x37')](handleError(_0x2b3239,null));};exports['destroy']=function(_0x56dec8,_0x5d9ffe){return db[_0x891e('0x35')]['find']({'where':{'id':_0x56dec8[_0x891e('0x3a')]['id']}})['then'](handleEntityNotFound(_0x5d9ffe,null))[_0x891e('0x23')](removeEntity(_0x5d9ffe,null))[_0x891e('0x37')](handleError(_0x5d9ffe,null));};
\ No newline at end of file
+var _0x35ef=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','count','offset','limit','status','Content-Range','json','reject','then','destroy','error','stack','name','send','show','params','ChatProactiveAction','rawAttributes','keys','query','filters','attributes','model','fields','length','includeAll','include','options','find','catch','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x40cb7a,_0x505484){var _0x246f9c=function(_0x3bd730){while(--_0x3bd730){_0x40cb7a['push'](_0x40cb7a['shift']());}};_0x246f9c(++_0x505484);}(_0x35ef,0x140));var _0xf35e=function(_0x5229a1,_0x5349f8){_0x5229a1=_0x5229a1-0x0;var _0xc4cb55=_0x35ef[_0x5229a1];return _0xc4cb55;};'use strict';var pdf=require(_0xf35e('0x0'));var emlformat=require(_0xf35e('0x1'));var rimraf=require(_0xf35e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf35e('0x3'));var rp=require(_0xf35e('0x4'));var moment=require(_0xf35e('0x5'));var BPromise=require(_0xf35e('0x6'));var Mustache=require(_0xf35e('0x7'));var util=require(_0xf35e('0x8'));var path=require('path');var sox=require(_0xf35e('0x9'));var csv=require(_0xf35e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf35e('0xb'));var jsforce=require(_0xf35e('0xc'));var deskjs=require(_0xf35e('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf35e('0xe'));var Papa=require('papaparse');var Redis=require(_0xf35e('0xf'));var authService=require(_0xf35e('0x10'));var qs=require(_0xf35e('0x11'));var as=require(_0xf35e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf35e('0x13'))('api');var utils=require(_0xf35e('0x14'));var config=require(_0xf35e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf35e('0x16'))['db'];function respondWithStatusCode(_0x35747e,_0x23e970){_0x23e970=_0x23e970||0xcc;return function(_0x4292ad){if(_0x4292ad){return _0x35747e[_0xf35e('0x17')](_0x23e970);}return _0x35747e['status'](_0x23e970)[_0xf35e('0x18')]();};}function respondWithResult(_0x5df739,_0x2fc0ca){_0x2fc0ca=_0x2fc0ca||0xc8;return function(_0x5e327c){if(_0x5e327c){return _0x5df739['status'](_0x2fc0ca)['json'](_0x5e327c);}};}function respondWithFilteredResult(_0x51d95c,_0x197454){return function(_0x3b9468){if(_0x3b9468){var _0x45eeba=_0x3b9468[_0xf35e('0x19')],_0x14d750=_0x197454[_0xf35e('0x1a')],_0x589e4a=_0x197454[_0xf35e('0x1a')]+_0x197454[_0xf35e('0x1b')],_0x1fdec7;if(_0x589e4a>=_0x45eeba){_0x589e4a=_0x45eeba;_0x1fdec7=0xc8;}else{_0x1fdec7=0xce;}_0x51d95c[_0xf35e('0x1c')](_0x1fdec7);return _0x51d95c['set'](_0xf35e('0x1d'),_0x14d750+'-'+_0x589e4a+'/'+_0x45eeba)[_0xf35e('0x1e')](_0x3b9468);}return null;};}function patchUpdates(_0x381a4c){return function(_0x304ba9){try{jsonpatch['apply'](_0x304ba9,_0x381a4c,!![]);}catch(_0x351a22){return BPromise[_0xf35e('0x1f')](_0x351a22);}return _0x304ba9['save']();};}function saveUpdates(_0x15e567,_0x20932a){return function(_0x476821){if(_0x476821){return _0x476821['update'](_0x15e567)[_0xf35e('0x20')](function(_0xa52b04){return _0xa52b04;});}return null;};}function removeEntity(_0x5636ba,_0x3ff909){return function(_0x187c32){if(_0x187c32){return _0x187c32[_0xf35e('0x21')]()[_0xf35e('0x20')](function(){_0x5636ba[_0xf35e('0x1c')](0xcc)[_0xf35e('0x18')]();});}};}function handleEntityNotFound(_0x54e761,_0x435b0e){return function(_0x4d013a){if(!_0x4d013a){_0x54e761[_0xf35e('0x17')](0x194);}return _0x4d013a;};}function handleError(_0x59e215,_0x4e70ed){_0x4e70ed=_0x4e70ed||0x1f4;return function(_0xec8a40){logger[_0xf35e('0x22')](_0xec8a40[_0xf35e('0x23')]);if(_0xec8a40[_0xf35e('0x24')]){delete _0xec8a40['name'];}_0x59e215[_0xf35e('0x1c')](_0x4e70ed)[_0xf35e('0x25')](_0xec8a40);};}exports[_0xf35e('0x26')]=function(_0x4e1c37,_0x7b05e2){var _0x205d45={'raw':!![],'where':{'id':_0x4e1c37[_0xf35e('0x27')]['id']}},_0x2e14bc={};_0x2e14bc['model']=_['keys'](db[_0xf35e('0x28')][_0xf35e('0x29')]);_0x2e14bc['query']=_[_0xf35e('0x2a')](_0x4e1c37[_0xf35e('0x2b')]);_0x2e14bc[_0xf35e('0x2c')]=_['intersection'](_0x2e14bc['model'],_0x2e14bc['query']);_0x205d45[_0xf35e('0x2d')]=_['intersection'](_0x2e14bc[_0xf35e('0x2e')],qs[_0xf35e('0x2f')](_0x4e1c37[_0xf35e('0x2b')][_0xf35e('0x2f')]));_0x205d45[_0xf35e('0x2d')]=_0x205d45[_0xf35e('0x2d')][_0xf35e('0x30')]?_0x205d45['attributes']:_0x2e14bc['model'];if(_0x4e1c37[_0xf35e('0x2b')][_0xf35e('0x31')]){_0x205d45[_0xf35e('0x32')]=[{'all':!![]}];}_0x205d45=_['merge']({},_0x205d45,_0x4e1c37[_0xf35e('0x33')]);return db[_0xf35e('0x28')][_0xf35e('0x34')](_0x205d45)[_0xf35e('0x20')](handleEntityNotFound(_0x7b05e2,null))[_0xf35e('0x20')](respondWithResult(_0x7b05e2,null))[_0xf35e('0x35')](handleError(_0x7b05e2,null));};exports[_0xf35e('0x36')]=function(_0x61b7c4,_0x3ca671){return db[_0xf35e('0x28')][_0xf35e('0x36')](_0x61b7c4[_0xf35e('0x37')],{})['then'](respondWithResult(_0x3ca671,0xc9))['catch'](handleError(_0x3ca671,null));};exports['update']=function(_0x479afb,_0x32ed36){if(_0x479afb[_0xf35e('0x37')]['id']){delete _0x479afb[_0xf35e('0x37')]['id'];}return db[_0xf35e('0x28')][_0xf35e('0x34')]({'where':{'id':_0x479afb['params']['id']}})[_0xf35e('0x20')](handleEntityNotFound(_0x32ed36,null))[_0xf35e('0x20')](saveUpdates(_0x479afb['body'],null))[_0xf35e('0x20')](respondWithResult(_0x32ed36,null))['catch'](handleError(_0x32ed36,null));};exports[_0xf35e('0x21')]=function(_0x5d905f,_0x280695){return db[_0xf35e('0x28')][_0xf35e('0x34')]({'where':{'id':_0x5d905f[_0xf35e('0x27')]['id']}})['then'](handleEntityNotFound(_0x280695,null))[_0xf35e('0x20')](removeEntity(_0x280695,null))[_0xf35e('0x35')](handleError(_0x280695,null));};
\ No newline at end of file