Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / api / intZendeskField / intZendeskField.controller.js
index 7472e1d..b19b4f7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x958a=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','json','apply','reject','update','destroy','error','name','send','index','map','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','then','includeAll','findAll','show','params','rawAttributes','include','ZendeskField','find','catch','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x958a,0x128));var _0xa958=function(_0x38edf1,_0xb0ab72){_0x38edf1=_0x38edf1-0x0;var _0xc614d3=_0x958a[_0x38edf1];return _0xc614d3;};'use strict';var pdf=require(_0xa958('0x0'));var emlformat=require(_0xa958('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa958('0x2'));var jsonpatch=require(_0xa958('0x3'));var rp=require(_0xa958('0x4'));var moment=require(_0xa958('0x5'));var BPromise=require(_0xa958('0x6'));var Mustache=require('mustache');var util=require(_0xa958('0x7'));var path=require('path');var sox=require(_0xa958('0x8'));var csv=require(_0xa958('0x9'));var ejs=require(_0xa958('0xa'));var fs=require('fs');var _=require(_0xa958('0xb'));var squel=require(_0xa958('0xc'));var crypto=require(_0xa958('0xd'));var jsforce=require(_0xa958('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa958('0xf'));var Papa=require(_0xa958('0x10'));var Redis=require(_0xa958('0x11'));var authService=require(_0xa958('0x12'));var qs=require(_0xa958('0x13'));var as=require(_0xa958('0x14'));var hardwareService=require(_0xa958('0x15'));var logger=require(_0xa958('0x16'))(_0xa958('0x17'));var utils=require(_0xa958('0x18'));var config=require(_0xa958('0x19'));var licenseUtil=require(_0xa958('0x1a'));var db=require(_0xa958('0x1b'))['db'];function respondWithStatusCode(_0x53bf27,_0x5063ae){_0x5063ae=_0x5063ae||0xcc;return function(_0x5bcc66){if(_0x5bcc66){return _0x53bf27[_0xa958('0x1c')](_0x5063ae);}return _0x53bf27[_0xa958('0x1d')](_0x5063ae)[_0xa958('0x1e')]();};}function respondWithResult(_0x591d4d,_0x3ebc66){_0x3ebc66=_0x3ebc66||0xc8;return function(_0x54c439){if(_0x54c439){return _0x591d4d['status'](_0x3ebc66)['json'](_0x54c439);}};}function respondWithFilteredResult(_0x1fe41e,_0x15fca8){return function(_0xb90ac6){if(_0xb90ac6){var _0x6a81c7=_0xb90ac6[_0xa958('0x1f')],_0x2c270c=_0x15fca8['offset'],_0x398931=_0x15fca8[_0xa958('0x20')]+_0x15fca8['limit'],_0x23736f;if(_0x398931>=_0x6a81c7){_0x398931=_0x6a81c7;_0x23736f=0xc8;}else{_0x23736f=0xce;}_0x1fe41e[_0xa958('0x1d')](_0x23736f);return _0x1fe41e[_0xa958('0x21')]('Content-Range',_0x2c270c+'-'+_0x398931+'/'+_0x6a81c7)[_0xa958('0x22')](_0xb90ac6);}return null;};}function patchUpdates(_0x1b5eec){return function(_0x47636f){try{jsonpatch[_0xa958('0x23')](_0x47636f,_0x1b5eec,!![]);}catch(_0x2759ad){return BPromise[_0xa958('0x24')](_0x2759ad);}return _0x47636f['save']();};}function saveUpdates(_0x4a90c2,_0x373661){return function(_0x1f48b7){if(_0x1f48b7){return _0x1f48b7[_0xa958('0x25')](_0x4a90c2)['then'](function(_0x1eec1d){return _0x1eec1d;});}return null;};}function removeEntity(_0x383aa3,_0x5c091a){return function(_0x28cf12){if(_0x28cf12){return _0x28cf12[_0xa958('0x26')]()['then'](function(){_0x383aa3['status'](0xcc)[_0xa958('0x1e')]();});}};}function handleEntityNotFound(_0x40b51e,_0x50b3c3){return function(_0x25f461){if(!_0x25f461){_0x40b51e[_0xa958('0x1c')](0x194);}return _0x25f461;};}function handleError(_0x2f03df,_0x347b72){_0x347b72=_0x347b72||0x1f4;return function(_0x16b04a){logger[_0xa958('0x27')](_0x16b04a['stack']);if(_0x16b04a[_0xa958('0x28')]){delete _0x16b04a['name'];}_0x2f03df[_0xa958('0x1d')](_0x347b72)[_0xa958('0x29')](_0x16b04a);};}exports[_0xa958('0x2a')]=function(_0x18f600,_0x21541f){var _0xddc7f6={},_0x2c970b={},_0xc75ae9={'count':0x0,'rows':[]};var _0x12cfde=_[_0xa958('0x2b')](db['ZendeskField']['rawAttributes'],function(_0xd2fcc9){return{'name':_0xd2fcc9['fieldName'],'type':_0xd2fcc9[_0xa958('0x2c')][_0xa958('0x2d')]};});_0x2c970b['model']=_[_0xa958('0x2b')](_0x12cfde,_0xa958('0x28'));_0x2c970b[_0xa958('0x2e')]=_[_0xa958('0x2f')](_0x18f600[_0xa958('0x2e')]);_0x2c970b['filters']=_['intersection'](_0x2c970b[_0xa958('0x30')],_0x2c970b['query']);_0xddc7f6['attributes']=_[_0xa958('0x31')](_0x2c970b[_0xa958('0x30')],qs[_0xa958('0x32')](_0x18f600[_0xa958('0x2e')][_0xa958('0x32')]));_0xddc7f6[_0xa958('0x33')]=_0xddc7f6['attributes'][_0xa958('0x34')]?_0xddc7f6['attributes']:_0x2c970b['model'];if(!_0x18f600[_0xa958('0x2e')][_0xa958('0x35')](_0xa958('0x36'))){_0xddc7f6[_0xa958('0x37')]=qs[_0xa958('0x37')](_0x18f600[_0xa958('0x2e')][_0xa958('0x37')]);_0xddc7f6[_0xa958('0x20')]=qs['offset'](_0x18f600['query'][_0xa958('0x20')]);}_0xddc7f6[_0xa958('0x38')]=qs[_0xa958('0x39')](_0x18f600[_0xa958('0x2e')][_0xa958('0x39')]);_0xddc7f6['where']=qs[_0xa958('0x3a')](_[_0xa958('0x3b')](_0x18f600[_0xa958('0x2e')],_0x2c970b[_0xa958('0x3a')]),_0x12cfde);if(_0x18f600['query'][_0xa958('0x3c')]){_0xddc7f6[_0xa958('0x3d')]=_[_0xa958('0x3e')](_0xddc7f6[_0xa958('0x3d')],{'$or':_[_0xa958('0x2b')](_0x12cfde,function(_0x48189e){if(_0x48189e[_0xa958('0x2c')]!==_0xa958('0x3f')){var _0x39af1e={};_0x39af1e[_0x48189e[_0xa958('0x28')]]={'$like':'%'+_0x18f600[_0xa958('0x2e')][_0xa958('0x3c')]+'%'};return _0x39af1e;}})});}_0xddc7f6=_[_0xa958('0x3e')]({},_0xddc7f6,_0x18f600[_0xa958('0x40')]);var _0x2378df={'where':_0xddc7f6[_0xa958('0x3d')]};return db['ZendeskField'][_0xa958('0x1f')](_0x2378df)[_0xa958('0x41')](function(_0x454a00){_0xc75ae9['count']=_0x454a00;if(_0x18f600[_0xa958('0x2e')][_0xa958('0x42')]){_0xddc7f6['include']=[{'all':!![]}];}return db['ZendeskField'][_0xa958('0x43')](_0xddc7f6);})['then'](function(_0x3b5e74){_0xc75ae9['rows']=_0x3b5e74;return _0xc75ae9;})[_0xa958('0x41')](respondWithFilteredResult(_0x21541f,_0xddc7f6))['catch'](handleError(_0x21541f,null));};exports[_0xa958('0x44')]=function(_0x1a5793,_0x44fa44){var _0x1af779={'raw':!![],'where':{'id':_0x1a5793[_0xa958('0x45')]['id']}},_0x1cdb9a={};_0x1cdb9a[_0xa958('0x30')]=_[_0xa958('0x2f')](db['ZendeskField'][_0xa958('0x46')]);_0x1cdb9a[_0xa958('0x2e')]=_[_0xa958('0x2f')](_0x1a5793['query']);_0x1cdb9a['filters']=_['intersection'](_0x1cdb9a[_0xa958('0x30')],_0x1cdb9a[_0xa958('0x2e')]);_0x1af779[_0xa958('0x33')]=_[_0xa958('0x31')](_0x1cdb9a[_0xa958('0x30')],qs['fields'](_0x1a5793[_0xa958('0x2e')][_0xa958('0x32')]));_0x1af779[_0xa958('0x33')]=_0x1af779[_0xa958('0x33')][_0xa958('0x34')]?_0x1af779[_0xa958('0x33')]:_0x1cdb9a[_0xa958('0x30')];if(_0x1a5793[_0xa958('0x2e')][_0xa958('0x42')]){_0x1af779[_0xa958('0x47')]=[{'all':!![]}];}_0x1af779=_[_0xa958('0x3e')]({},_0x1af779,_0x1a5793[_0xa958('0x40')]);return db[_0xa958('0x48')][_0xa958('0x49')](_0x1af779)[_0xa958('0x41')](handleEntityNotFound(_0x44fa44,null))[_0xa958('0x41')](respondWithResult(_0x44fa44,null))[_0xa958('0x4a')](handleError(_0x44fa44,null));};exports['create']=function(_0x5b8111,_0x5bfe18){return db[_0xa958('0x48')][_0xa958('0x4b')](_0x5b8111[_0xa958('0x4c')],{})[_0xa958('0x41')](respondWithResult(_0x5bfe18,0xc9))['catch'](handleError(_0x5bfe18,null));};exports[_0xa958('0x25')]=function(_0x3d6e80,_0xa07b67){if(_0x3d6e80[_0xa958('0x4c')]['id']){delete _0x3d6e80[_0xa958('0x4c')]['id'];}return db['ZendeskField'][_0xa958('0x49')]({'where':{'id':_0x3d6e80[_0xa958('0x45')]['id']}})[_0xa958('0x41')](handleEntityNotFound(_0xa07b67,null))['then'](saveUpdates(_0x3d6e80[_0xa958('0x4c')],null))['then'](respondWithResult(_0xa07b67,null))[_0xa958('0x4a')](handleError(_0xa07b67,null));};exports[_0xa958('0x26')]=function(_0x414fb1,_0x4e0740){return db[_0xa958('0x48')]['find']({'where':{'id':_0x414fb1[_0xa958('0x45')]['id']}})[_0xa958('0x41')](handleEntityNotFound(_0x4e0740,null))[_0xa958('0x41')](removeEntity(_0x4e0740,null))[_0xa958('0x4a')](handleError(_0x4e0740,null));};
\ No newline at end of file
+var _0x40ce=['sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','ZendeskField','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x3bc5bb,_0x280c54){var _0x13dc9f=function(_0x12472b){while(--_0x12472b){_0x3bc5bb['push'](_0x3bc5bb['shift']());}};_0x13dc9f(++_0x280c54);}(_0x40ce,0x110));var _0xe40c=function(_0x1649f2,_0x13fe1d){_0x1649f2=_0x1649f2-0x0;var _0x1a5626=_0x40ce[_0x1649f2];return _0x1a5626;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe40c('0x0'));var zipdir=require(_0xe40c('0x1'));var jsonpatch=require(_0xe40c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe40c('0x3'));var path=require(_0xe40c('0x4'));var sox=require(_0xe40c('0x5'));var csv=require(_0xe40c('0x6'));var ejs=require(_0xe40c('0x7'));var fs=require('fs');var fs_extra=require(_0xe40c('0x8'));var _=require(_0xe40c('0x9'));var squel=require(_0xe40c('0xa'));var crypto=require(_0xe40c('0xb'));var jsforce=require(_0xe40c('0xc'));var deskjs=require(_0xe40c('0xd'));var toCsv=require(_0xe40c('0x6'));var querystring=require(_0xe40c('0xe'));var Papa=require('papaparse');var Redis=require(_0xe40c('0xf'));var authService=require(_0xe40c('0x10'));var qs=require(_0xe40c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe40c('0x12'));var logger=require(_0xe40c('0x13'))(_0xe40c('0x14'));var utils=require(_0xe40c('0x15'));var config=require(_0xe40c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe40c('0x17'))['db'];function respondWithStatusCode(_0x20ea5f,_0x62257f){_0x62257f=_0x62257f||0xcc;return function(_0x21d14c){if(_0x21d14c){return _0x20ea5f[_0xe40c('0x18')](_0x62257f);}return _0x20ea5f['status'](_0x62257f)[_0xe40c('0x19')]();};}function respondWithResult(_0x474c05,_0xa36149){_0xa36149=_0xa36149||0xc8;return function(_0x2f5497){if(_0x2f5497){return _0x474c05[_0xe40c('0x1a')](_0xa36149)[_0xe40c('0x1b')](_0x2f5497);}};}function respondWithFilteredResult(_0x350ff1,_0x5aca04){return function(_0x93d8ca){if(_0x93d8ca){var _0x4cf110=typeof _0x5aca04[_0xe40c('0x1c')]==='undefined'&&typeof _0x5aca04[_0xe40c('0x1d')]===_0xe40c('0x1e');var _0x93f5d3=_0x93d8ca[_0xe40c('0x1f')];var _0x18d05d=_0x4cf110?0x0:_0x5aca04[_0xe40c('0x1c')];var _0x1dbe4b=_0x4cf110?_0x93d8ca[_0xe40c('0x1f')]:_0x5aca04[_0xe40c('0x1c')]+_0x5aca04[_0xe40c('0x1d')];var _0x16c98e;if(_0x1dbe4b>=_0x93f5d3){_0x1dbe4b=_0x93f5d3;_0x16c98e=0xc8;}else{_0x16c98e=0xce;}_0x350ff1['status'](_0x16c98e);return _0x350ff1['set'](_0xe40c('0x20'),_0x18d05d+'-'+_0x1dbe4b+'/'+_0x93f5d3)[_0xe40c('0x1b')](_0x93d8ca);}return null;};}function patchUpdates(_0x3e4f52){return function(_0x392bae){try{jsonpatch[_0xe40c('0x21')](_0x392bae,_0x3e4f52,!![]);}catch(_0x5b54ea){return BPromise[_0xe40c('0x22')](_0x5b54ea);}return _0x392bae[_0xe40c('0x23')]();};}function saveUpdates(_0x3ae56b,_0x5c9ce0){return function(_0x1e7260){if(_0x1e7260){return _0x1e7260[_0xe40c('0x24')](_0x3ae56b)[_0xe40c('0x25')](function(_0x2f649e){return _0x2f649e;});}return null;};}function removeEntity(_0xa6e793,_0x5f0a5d){return function(_0x2573f2){if(_0x2573f2){return _0x2573f2['destroy']()[_0xe40c('0x25')](function(){_0xa6e793[_0xe40c('0x1a')](0xcc)[_0xe40c('0x19')]();});}};}function handleEntityNotFound(_0x501275,_0x9a5746){return function(_0x24ba2d){if(!_0x24ba2d){_0x501275[_0xe40c('0x18')](0x194);}return _0x24ba2d;};}function handleError(_0x4cad58,_0x479601){_0x479601=_0x479601||0x1f4;return function(_0x29f851){logger[_0xe40c('0x26')](_0x29f851[_0xe40c('0x27')]);if(_0x29f851[_0xe40c('0x28')]){delete _0x29f851[_0xe40c('0x28')];}_0x4cad58[_0xe40c('0x1a')](_0x479601)['send'](_0x29f851);};}exports[_0xe40c('0x29')]=function(_0x12ee21,_0x3c99ff){var _0x6e455f={},_0x5de519={},_0x136758={'count':0x0,'rows':[]};var _0x2de4e7=_[_0xe40c('0x2a')](db[_0xe40c('0x2b')][_0xe40c('0x2c')],function(_0xd61afe){return{'name':_0xd61afe['fieldName'],'type':_0xd61afe[_0xe40c('0x2d')][_0xe40c('0x2e')]};});_0x5de519['model']=_[_0xe40c('0x2a')](_0x2de4e7,_0xe40c('0x28'));_0x5de519[_0xe40c('0x2f')]=_[_0xe40c('0x30')](_0x12ee21['query']);_0x5de519[_0xe40c('0x31')]=_['intersection'](_0x5de519[_0xe40c('0x32')],_0x5de519[_0xe40c('0x2f')]);_0x6e455f[_0xe40c('0x33')]=_[_0xe40c('0x34')](_0x5de519[_0xe40c('0x32')],qs[_0xe40c('0x35')](_0x12ee21['query'][_0xe40c('0x35')]));_0x6e455f['attributes']=_0x6e455f[_0xe40c('0x33')][_0xe40c('0x36')]?_0x6e455f[_0xe40c('0x33')]:_0x5de519[_0xe40c('0x32')];if(!_0x12ee21['query'][_0xe40c('0x37')](_0xe40c('0x38'))){_0x6e455f[_0xe40c('0x1d')]=qs[_0xe40c('0x1d')](_0x12ee21['query'][_0xe40c('0x1d')]);_0x6e455f[_0xe40c('0x1c')]=qs[_0xe40c('0x1c')](_0x12ee21['query'][_0xe40c('0x1c')]);}_0x6e455f[_0xe40c('0x39')]=qs['sort'](_0x12ee21[_0xe40c('0x2f')][_0xe40c('0x3a')]);_0x6e455f[_0xe40c('0x3b')]=qs[_0xe40c('0x31')](_[_0xe40c('0x3c')](_0x12ee21['query'],_0x5de519[_0xe40c('0x31')]),_0x2de4e7);if(_0x12ee21[_0xe40c('0x2f')][_0xe40c('0x3d')]){_0x6e455f[_0xe40c('0x3b')]=_[_0xe40c('0x3e')](_0x6e455f['where'],{'$or':_[_0xe40c('0x2a')](_0x2de4e7,function(_0x2a2375){if(_0x2a2375[_0xe40c('0x2d')]!==_0xe40c('0x3f')){var _0x335915={};_0x335915[_0x2a2375['name']]={'$like':'%'+_0x12ee21['query'][_0xe40c('0x3d')]+'%'};return _0x335915;}})});}_0x6e455f=_[_0xe40c('0x3e')]({},_0x6e455f,_0x12ee21[_0xe40c('0x40')]);var _0x1ffc76={'where':_0x6e455f[_0xe40c('0x3b')]};return db['ZendeskField'][_0xe40c('0x1f')](_0x1ffc76)['then'](function(_0x404640){_0x136758[_0xe40c('0x1f')]=_0x404640;if(_0x12ee21['query'][_0xe40c('0x41')]){_0x6e455f[_0xe40c('0x42')]=[{'all':!![]}];}return db[_0xe40c('0x2b')]['findAll'](_0x6e455f);})['then'](function(_0x521cae){_0x136758['rows']=_0x521cae;return _0x136758;})[_0xe40c('0x25')](respondWithFilteredResult(_0x3c99ff,_0x6e455f))[_0xe40c('0x43')](handleError(_0x3c99ff,null));};exports[_0xe40c('0x44')]=function(_0x1568df,_0x2ce377){var _0x460cce={'raw':!![],'where':{'id':_0x1568df[_0xe40c('0x45')]['id']}},_0x27b110={};_0x27b110[_0xe40c('0x32')]=_[_0xe40c('0x30')](db['ZendeskField']['rawAttributes']);_0x27b110[_0xe40c('0x2f')]=_['keys'](_0x1568df['query']);_0x27b110[_0xe40c('0x31')]=_[_0xe40c('0x34')](_0x27b110['model'],_0x27b110[_0xe40c('0x2f')]);_0x460cce[_0xe40c('0x33')]=_[_0xe40c('0x34')](_0x27b110[_0xe40c('0x32')],qs[_0xe40c('0x35')](_0x1568df['query'][_0xe40c('0x35')]));_0x460cce[_0xe40c('0x33')]=_0x460cce[_0xe40c('0x33')][_0xe40c('0x36')]?_0x460cce[_0xe40c('0x33')]:_0x27b110[_0xe40c('0x32')];if(_0x1568df[_0xe40c('0x2f')][_0xe40c('0x41')]){_0x460cce[_0xe40c('0x42')]=[{'all':!![]}];}_0x460cce=_['merge']({},_0x460cce,_0x1568df['options']);return db[_0xe40c('0x2b')][_0xe40c('0x46')](_0x460cce)[_0xe40c('0x25')](handleEntityNotFound(_0x2ce377,null))[_0xe40c('0x25')](respondWithResult(_0x2ce377,null))[_0xe40c('0x43')](handleError(_0x2ce377,null));};exports[_0xe40c('0x47')]=function(_0x5be499,_0x2aa1e6){return db[_0xe40c('0x2b')][_0xe40c('0x47')](_0x5be499['body'],{})[_0xe40c('0x25')](respondWithResult(_0x2aa1e6,0xc9))['catch'](handleError(_0x2aa1e6,null));};exports[_0xe40c('0x24')]=function(_0x499e1b,_0x5b80b7){if(_0x499e1b['body']['id']){delete _0x499e1b['body']['id'];}return db[_0xe40c('0x2b')]['find']({'where':{'id':_0x499e1b[_0xe40c('0x45')]['id']}})[_0xe40c('0x25')](handleEntityNotFound(_0x5b80b7,null))['then'](saveUpdates(_0x499e1b[_0xe40c('0x48')],null))[_0xe40c('0x25')](respondWithResult(_0x5b80b7,null))[_0xe40c('0x43')](handleError(_0x5b80b7,null));};exports[_0xe40c('0x49')]=function(_0x25b078,_0x33960f){return db[_0xe40c('0x2b')][_0xe40c('0x46')]({'where':{'id':_0x25b078[_0xe40c('0x45')]['id']}})['then'](handleEntityNotFound(_0x33960f,null))[_0xe40c('0x25')](removeEntity(_0x33960f,null))[_0xe40c('0x43')](handleError(_0x33960f,null));};
\ No newline at end of file