Built motion from commit (unavailable).|2.4.3
[motion2.git] / server / api / intVtigerConfiguration / intVtigerConfiguration.controller.js
index a1fe39e..1e42959 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf776=['includeAll','include','rows','params','find','create','body','getFields','VtigerField','hasOwnProperty','getSubjects','findOne','getDescriptions','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','VtigerConfiguration,\x20%s,\x20%s','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','destroy','stack','name','send','index','VtigerConfiguration','rawAttributes','keys','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','type','key','field','options'];(function(_0x2a4a05,_0x12a838){var _0x5edf87=function(_0x17777f){while(--_0x17777f){_0x2a4a05['push'](_0x2a4a05['shift']());}};_0x5edf87(++_0x12a838);}(_0xf776,0x169));var _0x6f77=function(_0x568145,_0x5c65e9){_0x568145=_0x568145-0x0;var _0x2c22a1=_0xf776[_0x568145];return _0x2c22a1;};'use strict';var pdf=require(_0x6f77('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6f77('0x1'));var zipdir=require(_0x6f77('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f77('0x3'));var moment=require(_0x6f77('0x4'));var BPromise=require(_0x6f77('0x5'));var Mustache=require(_0x6f77('0x6'));var util=require('util');var path=require(_0x6f77('0x7'));var sox=require('sox');var csv=require(_0x6f77('0x8'));var ejs=require(_0x6f77('0x9'));var fs=require('fs');var _=require(_0x6f77('0xa'));var squel=require(_0x6f77('0xb'));var crypto=require('crypto');var jsforce=require(_0x6f77('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6f77('0x8'));var querystring=require(_0x6f77('0xd'));var Papa=require(_0x6f77('0xe'));var Redis=require(_0x6f77('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6f77('0x10'));var hardwareService=require(_0x6f77('0x11'));var logger=require(_0x6f77('0x12'))(_0x6f77('0x13'));var utils=require(_0x6f77('0x14'));var config=require(_0x6f77('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x6f77('0x16'));var client=jayson[_0x6f77('0x17')][_0x6f77('0x18')]({'port':0x232a});function checkPasswordPattern(_0x17fda5,_0x413e19,_0x17cb33){if(_0x17cb33){var _0x276d6e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x276d6e[_0x6f77('0x19')](_0x413e19)){return _0x17fda5;}else{throw new Error(_0x6f77('0x1a'));}}else{return _0x17fda5;}}function respondWithRpcPromise(_0x28e354,_0x386c51,_0x811d22,_0x592079){return new BPromise(function(_0x48c26c,_0x17c0a5){var _0x2b9b87=_0x592079||client;return _0x2b9b87['request'](_0x28e354,_0x811d22)[_0x6f77('0x1b')](function(_0x55bb85){logger[_0x6f77('0x1c')](_0x6f77('0x1d'),_0x386c51,'request\x20sent');logger['debug'](_0x6f77('0x1e'),_0x386c51,_0x6f77('0x1f'),JSON[_0x6f77('0x20')](_0x55bb85));if(_0x55bb85[_0x6f77('0x21')]){if(_0x55bb85[_0x6f77('0x21')][_0x6f77('0x22')]===0x1f4){logger[_0x6f77('0x21')](_0x6f77('0x1d'),_0x386c51,_0x55bb85['error'][_0x6f77('0x23')]);return _0x17c0a5(_0x55bb85[_0x6f77('0x21')][_0x6f77('0x23')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x386c51,_0x55bb85[_0x6f77('0x21')][_0x6f77('0x23')]);return _0x48c26c(_0x55bb85['error'][_0x6f77('0x23')]);}else{logger[_0x6f77('0x1c')]('VtigerConfiguration,\x20%s,\x20%s',_0x386c51,_0x6f77('0x1f'));_0x48c26c(_0x55bb85[_0x6f77('0x24')][_0x6f77('0x23')]);}})[_0x6f77('0x25')](function(_0x2c0cb2){logger['error'](_0x6f77('0x1d'),_0x386c51,_0x2c0cb2);_0x17c0a5(_0x2c0cb2);});});}function respondWithStatusCode(_0x2cedee,_0x323f4b){_0x323f4b=_0x323f4b||0xcc;return function(_0x12a179){if(_0x12a179){return _0x2cedee[_0x6f77('0x26')](_0x323f4b);}return _0x2cedee[_0x6f77('0x27')](_0x323f4b)[_0x6f77('0x28')]();};}function respondWithResult(_0x502965,_0x4a35d0){_0x4a35d0=_0x4a35d0||0xc8;return function(_0x1f4af8){if(_0x1f4af8){return _0x502965[_0x6f77('0x27')](_0x4a35d0)[_0x6f77('0x29')](_0x1f4af8);}};}function respondWithFilteredResult(_0x45fc8b,_0x30c745){return function(_0x250254){if(_0x250254){var _0x4ff7aa=_0x250254[_0x6f77('0x2a')],_0x502306=_0x30c745[_0x6f77('0x2b')],_0x4107b7=_0x30c745[_0x6f77('0x2b')]+_0x30c745[_0x6f77('0x2c')],_0x3904f9;if(_0x4107b7>=_0x4ff7aa){_0x4107b7=_0x4ff7aa;_0x3904f9=0xc8;}else{_0x3904f9=0xce;}_0x45fc8b[_0x6f77('0x27')](_0x3904f9);return _0x45fc8b[_0x6f77('0x2d')]('Content-Range',_0x502306+'-'+_0x4107b7+'/'+_0x4ff7aa)['json'](_0x250254);}return null;};}function patchUpdates(_0x36d9d8){return function(_0x1fe6c3){try{jsonpatch[_0x6f77('0x2e')](_0x1fe6c3,_0x36d9d8,!![]);}catch(_0x438cbb){return BPromise[_0x6f77('0x2f')](_0x438cbb);}return _0x1fe6c3['save']();};}function saveUpdates(_0x80025a,_0x28cc44){return function(_0x1495ba){if(_0x1495ba){return _0x1495ba['update'](_0x80025a)[_0x6f77('0x1b')](function(_0x5bea99){return _0x5bea99;});}return null;};}function removeEntity(_0x49adce,_0x278f06){return function(_0x363a51){if(_0x363a51){return _0x363a51[_0x6f77('0x30')]()[_0x6f77('0x1b')](function(){_0x49adce[_0x6f77('0x27')](0xcc)[_0x6f77('0x28')]();});}};}function handleEntityNotFound(_0x33c69a,_0x3fa923){return function(_0x2695d4){if(!_0x2695d4){_0x33c69a['sendStatus'](0x194);}return _0x2695d4;};}function handleError(_0x3a3c39,_0x59cdbc){_0x59cdbc=_0x59cdbc||0x1f4;return function(_0x189293){logger['error'](_0x189293[_0x6f77('0x31')]);if(_0x189293[_0x6f77('0x32')]){delete _0x189293['name'];}_0x3a3c39[_0x6f77('0x27')](_0x59cdbc)[_0x6f77('0x33')](_0x189293);};}exports[_0x6f77('0x34')]=function(_0x42f484,_0x26cdc8){var _0x55ea57={},_0x222c8b={},_0x347d37={'count':0x0,'rows':[]};var _0x28dcff=db[_0x6f77('0x35')][_0x6f77('0x36')];_0x222c8b['model']=_[_0x6f77('0x37')](_0x28dcff);_0x222c8b[_0x6f77('0x38')]=_[_0x6f77('0x37')](_0x42f484[_0x6f77('0x38')]);_0x222c8b[_0x6f77('0x39')]=_['intersection'](_0x222c8b[_0x6f77('0x3a')],_0x222c8b['query']);_0x55ea57[_0x6f77('0x3b')]=_[_0x6f77('0x3c')](_0x222c8b[_0x6f77('0x3a')],qs[_0x6f77('0x3d')](_0x42f484[_0x6f77('0x38')]['fields']));_0x55ea57[_0x6f77('0x3b')]=_0x55ea57[_0x6f77('0x3b')][_0x6f77('0x3e')]?_0x55ea57['attributes']:_0x222c8b[_0x6f77('0x3a')];if(!_0x42f484[_0x6f77('0x38')]['hasOwnProperty'](_0x6f77('0x3f'))){_0x55ea57[_0x6f77('0x2c')]=qs[_0x6f77('0x2c')](_0x42f484[_0x6f77('0x38')][_0x6f77('0x2c')]);_0x55ea57['offset']=qs[_0x6f77('0x2b')](_0x42f484[_0x6f77('0x38')]['offset']);}_0x55ea57[_0x6f77('0x40')]=qs['sort'](_0x42f484[_0x6f77('0x38')][_0x6f77('0x41')]);_0x55ea57[_0x6f77('0x42')]=qs[_0x6f77('0x39')](_[_0x6f77('0x43')](_0x42f484[_0x6f77('0x38')],_0x222c8b[_0x6f77('0x39')]));if(_0x42f484[_0x6f77('0x38')][_0x6f77('0x44')]){_0x55ea57['where']=_[_0x6f77('0x45')](_0x55ea57[_0x6f77('0x42')],{'$or':_['map'](_0x28dcff,function(_0x509810){if(_0x509810[_0x6f77('0x46')][_0x6f77('0x47')]!=='VIRTUAL'){var _0x2c158c={};_0x2c158c[_0x509810[_0x6f77('0x48')]]={'$like':'%'+_0x42f484[_0x6f77('0x38')][_0x6f77('0x44')]+'%'};return _0x2c158c;}})});}_0x55ea57=_[_0x6f77('0x45')]({},_0x55ea57,_0x42f484[_0x6f77('0x49')]);var _0x4fae76={'where':_0x55ea57['where']};return db[_0x6f77('0x35')][_0x6f77('0x2a')](_0x4fae76)[_0x6f77('0x1b')](function(_0x561547){_0x347d37[_0x6f77('0x2a')]=_0x561547;if(_0x42f484[_0x6f77('0x38')][_0x6f77('0x4a')]){_0x55ea57[_0x6f77('0x4b')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x55ea57);})['then'](function(_0x4c3dd0){_0x347d37[_0x6f77('0x4c')]=_0x4c3dd0;return _0x347d37;})[_0x6f77('0x1b')](respondWithFilteredResult(_0x26cdc8,_0x55ea57))[_0x6f77('0x25')](handleError(_0x26cdc8,null));};exports['show']=function(_0x42af1f,_0x5d0568){var _0x2c5ddd={'raw':![],'where':{'id':_0x42af1f[_0x6f77('0x4d')]['id']}},_0x39547a={};_0x39547a[_0x6f77('0x3a')]=_[_0x6f77('0x37')](db['VtigerConfiguration'][_0x6f77('0x36')]);_0x39547a[_0x6f77('0x38')]=_['keys'](_0x42af1f[_0x6f77('0x38')]);_0x39547a['filters']=_['intersection'](_0x39547a[_0x6f77('0x3a')],_0x39547a[_0x6f77('0x38')]);_0x2c5ddd[_0x6f77('0x3b')]=_[_0x6f77('0x3c')](_0x39547a[_0x6f77('0x3a')],qs[_0x6f77('0x3d')](_0x42af1f[_0x6f77('0x38')][_0x6f77('0x3d')]));_0x2c5ddd[_0x6f77('0x3b')]=_0x2c5ddd['attributes']['length']?_0x2c5ddd[_0x6f77('0x3b')]:_0x39547a['model'];if(_0x42af1f[_0x6f77('0x38')][_0x6f77('0x4a')]){_0x2c5ddd['include']=[{'all':!![]}];}_0x2c5ddd=_[_0x6f77('0x45')]({},_0x2c5ddd,_0x42af1f[_0x6f77('0x49')]);return db[_0x6f77('0x35')][_0x6f77('0x4e')](_0x2c5ddd)[_0x6f77('0x1b')](handleEntityNotFound(_0x5d0568,null))[_0x6f77('0x1b')](respondWithResult(_0x5d0568,null))[_0x6f77('0x25')](handleError(_0x5d0568,null));};exports[_0x6f77('0x4f')]=function(_0x22ad86,_0x6f3541){return db[_0x6f77('0x35')][_0x6f77('0x4f')](_0x22ad86['body'],{})[_0x6f77('0x1b')](respondWithResult(_0x6f3541,0xc9))[_0x6f77('0x25')](handleError(_0x6f3541,null));};exports['update']=function(_0xf1bbb5,_0x8e9fc9){if(_0xf1bbb5[_0x6f77('0x50')]['id']){delete _0xf1bbb5[_0x6f77('0x50')]['id'];}return db[_0x6f77('0x35')][_0x6f77('0x4e')]({'where':{'id':_0xf1bbb5[_0x6f77('0x4d')]['id']}})[_0x6f77('0x1b')](handleEntityNotFound(_0x8e9fc9,null))[_0x6f77('0x1b')](saveUpdates(_0xf1bbb5[_0x6f77('0x50')],null))[_0x6f77('0x1b')](respondWithResult(_0x8e9fc9,null))[_0x6f77('0x25')](handleError(_0x8e9fc9,null));};exports[_0x6f77('0x30')]=function(_0x133c37,_0x5b6382){return db['VtigerConfiguration'][_0x6f77('0x4e')]({'where':{'id':_0x133c37[_0x6f77('0x4d')]['id']}})[_0x6f77('0x1b')](handleEntityNotFound(_0x5b6382,null))['then'](removeEntity(_0x5b6382,null))[_0x6f77('0x25')](handleError(_0x5b6382,null));};exports[_0x6f77('0x51')]=function(_0x121152,_0xd49933,_0x374b1c){var _0x5c7f2d={};var _0x3187f6={};var _0x179d4d;var _0x571376;return db[_0x6f77('0x35')]['findOne']({'where':{'id':_0x121152[_0x6f77('0x4d')]['id']}})[_0x6f77('0x1b')](handleEntityNotFound(_0xd49933,null))['then'](function(_0x49cf71){if(_0x49cf71){_0x179d4d=_0x49cf71;_0x3187f6[_0x6f77('0x3a')]=_[_0x6f77('0x37')](db[_0x6f77('0x52')]['rawAttributes']);_0x3187f6['query']=_['keys'](_0x121152[_0x6f77('0x38')]);_0x3187f6[_0x6f77('0x39')]=_[_0x6f77('0x3c')](_0x3187f6['model'],_0x3187f6[_0x6f77('0x38')]);_0x5c7f2d[_0x6f77('0x3b')]=_[_0x6f77('0x3c')](_0x3187f6['model'],qs[_0x6f77('0x3d')](_0x121152[_0x6f77('0x38')][_0x6f77('0x3d')]));_0x5c7f2d['attributes']=_0x5c7f2d['attributes'][_0x6f77('0x3e')]?_0x5c7f2d[_0x6f77('0x3b')]:_0x3187f6['model'];_0x5c7f2d['order']=qs[_0x6f77('0x41')](_0x121152[_0x6f77('0x38')]['sort']);_0x5c7f2d['where']=qs['filters'](_['pick'](_0x121152[_0x6f77('0x38')],_0x3187f6[_0x6f77('0x39')]));if(_0x121152[_0x6f77('0x38')][_0x6f77('0x44')]){_0x5c7f2d[_0x6f77('0x42')]=_[_0x6f77('0x45')](_0x5c7f2d[_0x6f77('0x42')],{'$or':_['map'](_0x5c7f2d[_0x6f77('0x3b')],function(_0x30ba4b){var _0x5d22e8={};_0x5d22e8[_0x30ba4b]={'$like':'%'+_0x121152[_0x6f77('0x38')]['filter']+'%'};return _0x5d22e8;})});}_0x5c7f2d=_['merge']({},_0x5c7f2d,_0x121152[_0x6f77('0x49')]);return _0x179d4d['getFields'](_0x5c7f2d);}})[_0x6f77('0x1b')](function(_0xdd9d62){if(_0xdd9d62){_0x571376=_0xdd9d62[_0x6f77('0x3e')];if(!_0x121152[_0x6f77('0x38')][_0x6f77('0x53')](_0x6f77('0x3f'))){_0x5c7f2d[_0x6f77('0x2c')]=qs['limit'](_0x121152[_0x6f77('0x38')][_0x6f77('0x2c')]);_0x5c7f2d[_0x6f77('0x2b')]=qs['offset'](_0x121152[_0x6f77('0x38')][_0x6f77('0x2b')]);}return _0x179d4d[_0x6f77('0x51')](_0x5c7f2d);}})[_0x6f77('0x1b')](function(_0x3846bc){if(_0x3846bc){return _0x3846bc?{'count':_0x571376,'rows':_0x3846bc}:null;}})['then'](respondWithResult(_0xd49933,null))[_0x6f77('0x25')](handleError(_0xd49933,null));};exports[_0x6f77('0x54')]=function(_0x239ea5,_0x4f3bd9,_0x22aa9e){var _0x4d658d={};var _0x3289c1={};var _0x3a3927;var _0x130c64;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x239ea5['params']['id']}})[_0x6f77('0x1b')](handleEntityNotFound(_0x4f3bd9,null))[_0x6f77('0x1b')](function(_0xc01c41){if(_0xc01c41){_0x3a3927=_0xc01c41;_0x3289c1[_0x6f77('0x3a')]=_[_0x6f77('0x37')](db['VtigerField']['rawAttributes']);_0x3289c1[_0x6f77('0x38')]=_[_0x6f77('0x37')](_0x239ea5[_0x6f77('0x38')]);_0x3289c1[_0x6f77('0x39')]=_[_0x6f77('0x3c')](_0x3289c1[_0x6f77('0x3a')],_0x3289c1['query']);_0x4d658d[_0x6f77('0x3b')]=_['intersection'](_0x3289c1[_0x6f77('0x3a')],qs[_0x6f77('0x3d')](_0x239ea5['query'][_0x6f77('0x3d')]));_0x4d658d['attributes']=_0x4d658d[_0x6f77('0x3b')][_0x6f77('0x3e')]?_0x4d658d[_0x6f77('0x3b')]:_0x3289c1['model'];_0x4d658d[_0x6f77('0x40')]=qs[_0x6f77('0x41')](_0x239ea5['query'][_0x6f77('0x41')]);_0x4d658d[_0x6f77('0x42')]=qs['filters'](_[_0x6f77('0x43')](_0x239ea5[_0x6f77('0x38')],_0x3289c1['filters']));if(_0x239ea5['query'][_0x6f77('0x44')]){_0x4d658d['where']=_[_0x6f77('0x45')](_0x4d658d['where'],{'$or':_['map'](_0x4d658d[_0x6f77('0x3b')],function(_0x129364){var _0x3d3951={};_0x3d3951[_0x129364]={'$like':'%'+_0x239ea5['query'][_0x6f77('0x44')]+'%'};return _0x3d3951;})});}_0x4d658d=_['merge']({},_0x4d658d,_0x239ea5['options']);return _0x3a3927['getSubjects'](_0x4d658d);}})[_0x6f77('0x1b')](function(_0x11e619){if(_0x11e619){_0x130c64=_0x11e619[_0x6f77('0x3e')];if(!_0x239ea5[_0x6f77('0x38')]['hasOwnProperty'](_0x6f77('0x3f'))){_0x4d658d[_0x6f77('0x2c')]=qs[_0x6f77('0x2c')](_0x239ea5[_0x6f77('0x38')][_0x6f77('0x2c')]);_0x4d658d[_0x6f77('0x2b')]=qs[_0x6f77('0x2b')](_0x239ea5[_0x6f77('0x38')]['offset']);}return _0x3a3927[_0x6f77('0x54')](_0x4d658d);}})['then'](function(_0x2f0e24){if(_0x2f0e24){return _0x2f0e24?{'count':_0x130c64,'rows':_0x2f0e24}:null;}})[_0x6f77('0x1b')](respondWithResult(_0x4f3bd9,null))[_0x6f77('0x25')](handleError(_0x4f3bd9,null));};exports['getDescriptions']=function(_0x2c1eda,_0x1b0985,_0x5dcca1){var _0x345d46={};var _0x489cf6={};var _0x15d233;var _0x689191;return db[_0x6f77('0x35')][_0x6f77('0x55')]({'where':{'id':_0x2c1eda[_0x6f77('0x4d')]['id']}})[_0x6f77('0x1b')](handleEntityNotFound(_0x1b0985,null))[_0x6f77('0x1b')](function(_0xb69bc2){if(_0xb69bc2){_0x15d233=_0xb69bc2;_0x489cf6[_0x6f77('0x3a')]=_['keys'](db[_0x6f77('0x52')][_0x6f77('0x36')]);_0x489cf6[_0x6f77('0x38')]=_[_0x6f77('0x37')](_0x2c1eda[_0x6f77('0x38')]);_0x489cf6[_0x6f77('0x39')]=_[_0x6f77('0x3c')](_0x489cf6[_0x6f77('0x3a')],_0x489cf6[_0x6f77('0x38')]);_0x345d46['attributes']=_['intersection'](_0x489cf6[_0x6f77('0x3a')],qs[_0x6f77('0x3d')](_0x2c1eda[_0x6f77('0x38')][_0x6f77('0x3d')]));_0x345d46[_0x6f77('0x3b')]=_0x345d46[_0x6f77('0x3b')]['length']?_0x345d46[_0x6f77('0x3b')]:_0x489cf6[_0x6f77('0x3a')];_0x345d46['order']=qs['sort'](_0x2c1eda[_0x6f77('0x38')][_0x6f77('0x41')]);_0x345d46[_0x6f77('0x42')]=qs['filters'](_[_0x6f77('0x43')](_0x2c1eda[_0x6f77('0x38')],_0x489cf6[_0x6f77('0x39')]));if(_0x2c1eda[_0x6f77('0x38')][_0x6f77('0x44')]){_0x345d46['where']=_[_0x6f77('0x45')](_0x345d46[_0x6f77('0x42')],{'$or':_['map'](_0x345d46[_0x6f77('0x3b')],function(_0x4ac0ab){var _0x12d80f={};_0x12d80f[_0x4ac0ab]={'$like':'%'+_0x2c1eda[_0x6f77('0x38')][_0x6f77('0x44')]+'%'};return _0x12d80f;})});}_0x345d46=_[_0x6f77('0x45')]({},_0x345d46,_0x2c1eda[_0x6f77('0x49')]);return _0x15d233['getDescriptions'](_0x345d46);}})[_0x6f77('0x1b')](function(_0x1d6262){if(_0x1d6262){_0x689191=_0x1d6262[_0x6f77('0x3e')];if(!_0x2c1eda['query'][_0x6f77('0x53')]('nolimit')){_0x345d46['limit']=qs[_0x6f77('0x2c')](_0x2c1eda[_0x6f77('0x38')]['limit']);_0x345d46['offset']=qs['offset'](_0x2c1eda[_0x6f77('0x38')][_0x6f77('0x2b')]);}return _0x15d233[_0x6f77('0x56')](_0x345d46);}})[_0x6f77('0x1b')](function(_0x5b224c){if(_0x5b224c){return _0x5b224c?{'count':_0x689191,'rows':_0x5b224c}:null;}})[_0x6f77('0x1b')](respondWithResult(_0x1b0985,null))[_0x6f77('0x25')](handleError(_0x1b0985,null));};
\ No newline at end of file
+var _0x24ca=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','VtigerConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','status','end','json','count','offset','limit','set','save','update','then','destroy','sendStatus','stack','name','send','index','VtigerConfiguration','rawAttributes','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL','field','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','getFields','findOne','VtigerField','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0xb381b2,_0x1d209f){var _0x3e24fd=function(_0x1c5609){while(--_0x1c5609){_0xb381b2['push'](_0xb381b2['shift']());}};_0x3e24fd(++_0x1d209f);}(_0x24ca,0x1bc));var _0xa24c=function(_0x5c72ee,_0x5a8bf8){_0x5c72ee=_0x5c72ee-0x0;var _0x231876=_0x24ca[_0x5c72ee];return _0x231876;};'use strict';var pdf=require(_0xa24c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa24c('0x1'));var zipdir=require(_0xa24c('0x2'));var jsonpatch=require(_0xa24c('0x3'));var rp=require('request-promise');var moment=require(_0xa24c('0x4'));var BPromise=require(_0xa24c('0x5'));var Mustache=require(_0xa24c('0x6'));var util=require(_0xa24c('0x7'));var path=require(_0xa24c('0x8'));var sox=require(_0xa24c('0x9'));var csv=require(_0xa24c('0xa'));var ejs=require(_0xa24c('0xb'));var fs=require('fs');var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0xa'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var hardwareService=require(_0xa24c('0x14'));var logger=require(_0xa24c('0x15'))(_0xa24c('0x16'));var utils=require(_0xa24c('0x17'));var config=require(_0xa24c('0x18'));var db=require(_0xa24c('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xa24c('0x1a')][_0xa24c('0x1b')]({'port':0x232a});function checkPasswordPattern(_0xcee4fe,_0x2c2af8,_0x5a9486){if(_0x5a9486){var _0x3ad0bf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3ad0bf[_0xa24c('0x1c')](_0x2c2af8)){return _0xcee4fe;}else{throw new Error(_0xa24c('0x1d'));}}else{return _0xcee4fe;}}function respondWithRpcPromise(_0x2fcd8b,_0x1cb08e,_0x2d185c,_0x448275){return new BPromise(function(_0x5d4727,_0x47a063){var _0xb80781=_0x448275||client;return _0xb80781[_0xa24c('0x1e')](_0x2fcd8b,_0x2d185c)['then'](function(_0x5babb5){logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x1cb08e,'request\x20sent');logger[_0xa24c('0x21')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x1cb08e,_0xa24c('0x22'),JSON[_0xa24c('0x23')](_0x5babb5));if(_0x5babb5[_0xa24c('0x24')]){if(_0x5babb5[_0xa24c('0x24')]['code']===0x1f4){logger[_0xa24c('0x24')](_0xa24c('0x20'),_0x1cb08e,_0x5babb5[_0xa24c('0x24')]['message']);return _0x47a063(_0x5babb5['error']['message']);}logger['error'](_0xa24c('0x20'),_0x1cb08e,_0x5babb5[_0xa24c('0x24')][_0xa24c('0x25')]);return _0x5d4727(_0x5babb5[_0xa24c('0x24')]['message']);}else{logger[_0xa24c('0x1f')]('VtigerConfiguration,\x20%s,\x20%s',_0x1cb08e,_0xa24c('0x22'));_0x5d4727(_0x5babb5[_0xa24c('0x26')]['message']);}})[_0xa24c('0x27')](function(_0x363d52){logger[_0xa24c('0x24')](_0xa24c('0x20'),_0x1cb08e,_0x363d52);_0x47a063(_0x363d52);});});}function respondWithStatusCode(_0x14cc65,_0x47e0eb){_0x47e0eb=_0x47e0eb||0xcc;return function(_0xec9167){if(_0xec9167){return _0x14cc65['sendStatus'](_0x47e0eb);}return _0x14cc65[_0xa24c('0x28')](_0x47e0eb)[_0xa24c('0x29')]();};}function respondWithResult(_0x294685,_0x51dc3f){_0x51dc3f=_0x51dc3f||0xc8;return function(_0x1beb55){if(_0x1beb55){return _0x294685[_0xa24c('0x28')](_0x51dc3f)[_0xa24c('0x2a')](_0x1beb55);}};}function respondWithFilteredResult(_0x314121,_0x11e4e0){return function(_0x3ad0e6){if(_0x3ad0e6){var _0x39609a=_0x3ad0e6[_0xa24c('0x2b')],_0x5b23f4=_0x11e4e0[_0xa24c('0x2c')],_0xa0c48e=_0x11e4e0['offset']+_0x11e4e0[_0xa24c('0x2d')],_0x28675f;if(_0xa0c48e>=_0x39609a){_0xa0c48e=_0x39609a;_0x28675f=0xc8;}else{_0x28675f=0xce;}_0x314121[_0xa24c('0x28')](_0x28675f);return _0x314121[_0xa24c('0x2e')]('Content-Range',_0x5b23f4+'-'+_0xa0c48e+'/'+_0x39609a)[_0xa24c('0x2a')](_0x3ad0e6);}return null;};}function patchUpdates(_0x3dcb1b){return function(_0x253d83){try{jsonpatch['apply'](_0x253d83,_0x3dcb1b,!![]);}catch(_0x245fb2){return BPromise['reject'](_0x245fb2);}return _0x253d83[_0xa24c('0x2f')]();};}function saveUpdates(_0x3a0c14,_0x1a247b){return function(_0x5d025a){if(_0x5d025a){return _0x5d025a[_0xa24c('0x30')](_0x3a0c14)[_0xa24c('0x31')](function(_0x1d0379){return _0x1d0379;});}return null;};}function removeEntity(_0x52572f,_0x1c1ed3){return function(_0x57c340){if(_0x57c340){return _0x57c340[_0xa24c('0x32')]()[_0xa24c('0x31')](function(){_0x52572f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20a276,_0x12670c){return function(_0x182e86){if(!_0x182e86){_0x20a276[_0xa24c('0x33')](0x194);}return _0x182e86;};}function handleError(_0x298dec,_0x461275){_0x461275=_0x461275||0x1f4;return function(_0x4416a4){logger['error'](_0x4416a4[_0xa24c('0x34')]);if(_0x4416a4[_0xa24c('0x35')]){delete _0x4416a4[_0xa24c('0x35')];}_0x298dec[_0xa24c('0x28')](_0x461275)[_0xa24c('0x36')](_0x4416a4);};}exports[_0xa24c('0x37')]=function(_0x86902f,_0x81d471){var _0x1ea166={},_0x129bb9={},_0x4c7a30={'count':0x0,'rows':[]};var _0x70a957=db[_0xa24c('0x38')][_0xa24c('0x39')];_0x129bb9[_0xa24c('0x3a')]=_['keys'](_0x70a957);_0x129bb9['query']=_[_0xa24c('0x3b')](_0x86902f['query']);_0x129bb9[_0xa24c('0x3c')]=_[_0xa24c('0x3d')](_0x129bb9[_0xa24c('0x3a')],_0x129bb9[_0xa24c('0x3e')]);_0x1ea166[_0xa24c('0x3f')]=_['intersection'](_0x129bb9['model'],qs[_0xa24c('0x40')](_0x86902f[_0xa24c('0x3e')][_0xa24c('0x40')]));_0x1ea166[_0xa24c('0x3f')]=_0x1ea166[_0xa24c('0x3f')][_0xa24c('0x41')]?_0x1ea166['attributes']:_0x129bb9['model'];if(!_0x86902f[_0xa24c('0x3e')][_0xa24c('0x42')](_0xa24c('0x43'))){_0x1ea166[_0xa24c('0x2d')]=qs[_0xa24c('0x2d')](_0x86902f['query'][_0xa24c('0x2d')]);_0x1ea166[_0xa24c('0x2c')]=qs['offset'](_0x86902f['query'][_0xa24c('0x2c')]);}_0x1ea166[_0xa24c('0x44')]=qs[_0xa24c('0x45')](_0x86902f['query']['sort']);_0x1ea166[_0xa24c('0x46')]=qs[_0xa24c('0x3c')](_[_0xa24c('0x47')](_0x86902f[_0xa24c('0x3e')],_0x129bb9[_0xa24c('0x3c')]));if(_0x86902f[_0xa24c('0x3e')][_0xa24c('0x48')]){_0x1ea166[_0xa24c('0x46')]=_['merge'](_0x1ea166['where'],{'$or':_[_0xa24c('0x49')](_0x70a957,function(_0x44f7d4){if(_0x44f7d4[_0xa24c('0x4a')]['key']!==_0xa24c('0x4b')){var _0x51df93={};_0x51df93[_0x44f7d4[_0xa24c('0x4c')]]={'$like':'%'+_0x86902f[_0xa24c('0x3e')][_0xa24c('0x48')]+'%'};return _0x51df93;}})});}_0x1ea166=_[_0xa24c('0x4d')]({},_0x1ea166,_0x86902f[_0xa24c('0x4e')]);var _0x35ed8a={'where':_0x1ea166[_0xa24c('0x46')]};return db[_0xa24c('0x38')]['count'](_0x35ed8a)[_0xa24c('0x31')](function(_0x183107){_0x4c7a30[_0xa24c('0x2b')]=_0x183107;if(_0x86902f['query'][_0xa24c('0x4f')]){_0x1ea166[_0xa24c('0x50')]=[{'all':!![]}];}return db[_0xa24c('0x38')][_0xa24c('0x51')](_0x1ea166);})[_0xa24c('0x31')](function(_0x16d340){_0x4c7a30[_0xa24c('0x52')]=_0x16d340;return _0x4c7a30;})[_0xa24c('0x31')](respondWithFilteredResult(_0x81d471,_0x1ea166))[_0xa24c('0x27')](handleError(_0x81d471,null));};exports[_0xa24c('0x53')]=function(_0x418525,_0x54dc72){var _0x29a84d={'raw':![],'where':{'id':_0x418525[_0xa24c('0x54')]['id']}},_0x96b977={};_0x96b977[_0xa24c('0x3a')]=_[_0xa24c('0x3b')](db[_0xa24c('0x38')][_0xa24c('0x39')]);_0x96b977[_0xa24c('0x3e')]=_[_0xa24c('0x3b')](_0x418525['query']);_0x96b977['filters']=_[_0xa24c('0x3d')](_0x96b977['model'],_0x96b977[_0xa24c('0x3e')]);_0x29a84d[_0xa24c('0x3f')]=_['intersection'](_0x96b977[_0xa24c('0x3a')],qs[_0xa24c('0x40')](_0x418525[_0xa24c('0x3e')]['fields']));_0x29a84d['attributes']=_0x29a84d[_0xa24c('0x3f')]['length']?_0x29a84d[_0xa24c('0x3f')]:_0x96b977[_0xa24c('0x3a')];if(_0x418525[_0xa24c('0x3e')][_0xa24c('0x4f')]){_0x29a84d[_0xa24c('0x50')]=[{'all':!![]}];}_0x29a84d=_[_0xa24c('0x4d')]({},_0x29a84d,_0x418525[_0xa24c('0x4e')]);return db[_0xa24c('0x38')][_0xa24c('0x55')](_0x29a84d)[_0xa24c('0x31')](handleEntityNotFound(_0x54dc72,null))['then'](respondWithResult(_0x54dc72,null))[_0xa24c('0x27')](handleError(_0x54dc72,null));};exports[_0xa24c('0x56')]=function(_0x233f8e,_0x513271){return db['VtigerConfiguration']['create'](_0x233f8e[_0xa24c('0x57')],{})['then'](respondWithResult(_0x513271,0xc9))[_0xa24c('0x27')](handleError(_0x513271,null));};exports[_0xa24c('0x30')]=function(_0x5a35e5,_0x25c6e5){if(_0x5a35e5[_0xa24c('0x57')]['id']){delete _0x5a35e5[_0xa24c('0x57')]['id'];}return db[_0xa24c('0x38')][_0xa24c('0x55')]({'where':{'id':_0x5a35e5[_0xa24c('0x54')]['id']}})[_0xa24c('0x31')](handleEntityNotFound(_0x25c6e5,null))[_0xa24c('0x31')](saveUpdates(_0x5a35e5['body'],null))[_0xa24c('0x31')](respondWithResult(_0x25c6e5,null))['catch'](handleError(_0x25c6e5,null));};exports['destroy']=function(_0x565f0a,_0x5bd2af){return db['VtigerConfiguration'][_0xa24c('0x55')]({'where':{'id':_0x565f0a['params']['id']}})[_0xa24c('0x31')](handleEntityNotFound(_0x5bd2af,null))[_0xa24c('0x31')](removeEntity(_0x5bd2af,null))[_0xa24c('0x27')](handleError(_0x5bd2af,null));};exports[_0xa24c('0x58')]=function(_0xa371d2,_0x2e1feb,_0x6f5aad){var _0x2406d6={};var _0x45f971={};var _0x3de0e3;var _0x303b7d;return db[_0xa24c('0x38')][_0xa24c('0x59')]({'where':{'id':_0xa371d2[_0xa24c('0x54')]['id']}})[_0xa24c('0x31')](handleEntityNotFound(_0x2e1feb,null))['then'](function(_0x25c571){if(_0x25c571){_0x3de0e3=_0x25c571;_0x45f971[_0xa24c('0x3a')]=_['keys'](db[_0xa24c('0x5a')][_0xa24c('0x39')]);_0x45f971[_0xa24c('0x3e')]=_[_0xa24c('0x3b')](_0xa371d2['query']);_0x45f971['filters']=_[_0xa24c('0x3d')](_0x45f971['model'],_0x45f971['query']);_0x2406d6[_0xa24c('0x3f')]=_[_0xa24c('0x3d')](_0x45f971[_0xa24c('0x3a')],qs[_0xa24c('0x40')](_0xa371d2['query']['fields']));_0x2406d6[_0xa24c('0x3f')]=_0x2406d6['attributes']['length']?_0x2406d6[_0xa24c('0x3f')]:_0x45f971[_0xa24c('0x3a')];_0x2406d6[_0xa24c('0x44')]=qs['sort'](_0xa371d2[_0xa24c('0x3e')][_0xa24c('0x45')]);_0x2406d6['where']=qs[_0xa24c('0x3c')](_[_0xa24c('0x47')](_0xa371d2[_0xa24c('0x3e')],_0x45f971['filters']));if(_0xa371d2[_0xa24c('0x3e')][_0xa24c('0x48')]){_0x2406d6[_0xa24c('0x46')]=_[_0xa24c('0x4d')](_0x2406d6[_0xa24c('0x46')],{'$or':_['map'](_0x2406d6[_0xa24c('0x3f')],function(_0x3f79c9){var _0x1e2da8={};_0x1e2da8[_0x3f79c9]={'$like':'%'+_0xa371d2[_0xa24c('0x3e')][_0xa24c('0x48')]+'%'};return _0x1e2da8;})});}_0x2406d6=_[_0xa24c('0x4d')]({},_0x2406d6,_0xa371d2[_0xa24c('0x4e')]);return _0x3de0e3['getFields'](_0x2406d6);}})[_0xa24c('0x31')](function(_0x33af18){if(_0x33af18){_0x303b7d=_0x33af18['length'];if(!_0xa371d2[_0xa24c('0x3e')][_0xa24c('0x42')](_0xa24c('0x43'))){_0x2406d6[_0xa24c('0x2d')]=qs[_0xa24c('0x2d')](_0xa371d2[_0xa24c('0x3e')][_0xa24c('0x2d')]);_0x2406d6[_0xa24c('0x2c')]=qs[_0xa24c('0x2c')](_0xa371d2[_0xa24c('0x3e')]['offset']);}return _0x3de0e3[_0xa24c('0x58')](_0x2406d6);}})[_0xa24c('0x31')](function(_0x3b894f){if(_0x3b894f){return _0x3b894f?{'count':_0x303b7d,'rows':_0x3b894f}:null;}})['then'](respondWithResult(_0x2e1feb,null))[_0xa24c('0x27')](handleError(_0x2e1feb,null));};exports[_0xa24c('0x5b')]=function(_0x2cc592,_0x5023e3,_0x3ac3a0){var _0x6a4385={};var _0x1abe7d={};var _0xc0f2bc;var _0x320901;return db[_0xa24c('0x38')]['findOne']({'where':{'id':_0x2cc592['params']['id']}})[_0xa24c('0x31')](handleEntityNotFound(_0x5023e3,null))['then'](function(_0x16678e){if(_0x16678e){_0xc0f2bc=_0x16678e;_0x1abe7d[_0xa24c('0x3a')]=_[_0xa24c('0x3b')](db[_0xa24c('0x5a')][_0xa24c('0x39')]);_0x1abe7d['query']=_[_0xa24c('0x3b')](_0x2cc592[_0xa24c('0x3e')]);_0x1abe7d[_0xa24c('0x3c')]=_[_0xa24c('0x3d')](_0x1abe7d[_0xa24c('0x3a')],_0x1abe7d[_0xa24c('0x3e')]);_0x6a4385['attributes']=_[_0xa24c('0x3d')](_0x1abe7d[_0xa24c('0x3a')],qs[_0xa24c('0x40')](_0x2cc592[_0xa24c('0x3e')]['fields']));_0x6a4385[_0xa24c('0x3f')]=_0x6a4385['attributes'][_0xa24c('0x41')]?_0x6a4385[_0xa24c('0x3f')]:_0x1abe7d[_0xa24c('0x3a')];_0x6a4385[_0xa24c('0x44')]=qs['sort'](_0x2cc592[_0xa24c('0x3e')][_0xa24c('0x45')]);_0x6a4385['where']=qs[_0xa24c('0x3c')](_[_0xa24c('0x47')](_0x2cc592[_0xa24c('0x3e')],_0x1abe7d[_0xa24c('0x3c')]));if(_0x2cc592[_0xa24c('0x3e')][_0xa24c('0x48')]){_0x6a4385[_0xa24c('0x46')]=_[_0xa24c('0x4d')](_0x6a4385['where'],{'$or':_[_0xa24c('0x49')](_0x6a4385[_0xa24c('0x3f')],function(_0x2cae90){var _0x28c3ff={};_0x28c3ff[_0x2cae90]={'$like':'%'+_0x2cc592[_0xa24c('0x3e')][_0xa24c('0x48')]+'%'};return _0x28c3ff;})});}_0x6a4385=_[_0xa24c('0x4d')]({},_0x6a4385,_0x2cc592[_0xa24c('0x4e')]);return _0xc0f2bc[_0xa24c('0x5b')](_0x6a4385);}})[_0xa24c('0x31')](function(_0xc4aa48){if(_0xc4aa48){_0x320901=_0xc4aa48['length'];if(!_0x2cc592[_0xa24c('0x3e')][_0xa24c('0x42')]('nolimit')){_0x6a4385[_0xa24c('0x2d')]=qs[_0xa24c('0x2d')](_0x2cc592[_0xa24c('0x3e')]['limit']);_0x6a4385['offset']=qs[_0xa24c('0x2c')](_0x2cc592[_0xa24c('0x3e')]['offset']);}return _0xc0f2bc[_0xa24c('0x5b')](_0x6a4385);}})[_0xa24c('0x31')](function(_0x106178){if(_0x106178){return _0x106178?{'count':_0x320901,'rows':_0x106178}:null;}})[_0xa24c('0x31')](respondWithResult(_0x5023e3,null))[_0xa24c('0x27')](handleError(_0x5023e3,null));};exports[_0xa24c('0x5c')]=function(_0x5e6e59,_0x47fc5f,_0x4ef0bc){var _0x263dab={};var _0x521894={};var _0x53462e;var _0xb3f567;return db[_0xa24c('0x38')][_0xa24c('0x59')]({'where':{'id':_0x5e6e59[_0xa24c('0x54')]['id']}})[_0xa24c('0x31')](handleEntityNotFound(_0x47fc5f,null))[_0xa24c('0x31')](function(_0x16f93a){if(_0x16f93a){_0x53462e=_0x16f93a;_0x521894[_0xa24c('0x3a')]=_[_0xa24c('0x3b')](db['VtigerField'][_0xa24c('0x39')]);_0x521894[_0xa24c('0x3e')]=_[_0xa24c('0x3b')](_0x5e6e59[_0xa24c('0x3e')]);_0x521894[_0xa24c('0x3c')]=_[_0xa24c('0x3d')](_0x521894[_0xa24c('0x3a')],_0x521894[_0xa24c('0x3e')]);_0x263dab[_0xa24c('0x3f')]=_[_0xa24c('0x3d')](_0x521894[_0xa24c('0x3a')],qs[_0xa24c('0x40')](_0x5e6e59['query'][_0xa24c('0x40')]));_0x263dab[_0xa24c('0x3f')]=_0x263dab['attributes'][_0xa24c('0x41')]?_0x263dab[_0xa24c('0x3f')]:_0x521894[_0xa24c('0x3a')];_0x263dab['order']=qs[_0xa24c('0x45')](_0x5e6e59[_0xa24c('0x3e')]['sort']);_0x263dab[_0xa24c('0x46')]=qs[_0xa24c('0x3c')](_['pick'](_0x5e6e59['query'],_0x521894[_0xa24c('0x3c')]));if(_0x5e6e59[_0xa24c('0x3e')][_0xa24c('0x48')]){_0x263dab[_0xa24c('0x46')]=_['merge'](_0x263dab[_0xa24c('0x46')],{'$or':_[_0xa24c('0x49')](_0x263dab[_0xa24c('0x3f')],function(_0x5c4554){var _0x56a29d={};_0x56a29d[_0x5c4554]={'$like':'%'+_0x5e6e59[_0xa24c('0x3e')][_0xa24c('0x48')]+'%'};return _0x56a29d;})});}_0x263dab=_[_0xa24c('0x4d')]({},_0x263dab,_0x5e6e59['options']);return _0x53462e['getDescriptions'](_0x263dab);}})[_0xa24c('0x31')](function(_0x51e48a){if(_0x51e48a){_0xb3f567=_0x51e48a['length'];if(!_0x5e6e59['query'][_0xa24c('0x42')](_0xa24c('0x43'))){_0x263dab[_0xa24c('0x2d')]=qs[_0xa24c('0x2d')](_0x5e6e59[_0xa24c('0x3e')][_0xa24c('0x2d')]);_0x263dab[_0xa24c('0x2c')]=qs[_0xa24c('0x2c')](_0x5e6e59[_0xa24c('0x3e')][_0xa24c('0x2c')]);}return _0x53462e[_0xa24c('0x5c')](_0x263dab);}})[_0xa24c('0x31')](function(_0x53dbe8){if(_0x53dbe8){return _0x53dbe8?{'count':_0xb3f567,'rows':_0x53dbe8}:null;}})[_0xa24c('0x31')](respondWithResult(_0x47fc5f,null))[_0xa24c('0x27')](handleError(_0x47fc5f,null));};
\ No newline at end of file