Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / api / intServicenowConfiguration / intServicenowConfiguration.controller.js
index 87f18f8..99be077 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5fc3=['path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','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','then','info','request\x20sent','debug','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','save','update','end','stack','name','index','ServicenowConfiguration','rawAttributes','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','key','VIRTUAL','field','filter','include','findAll','keys','includeAll','find','create','body','params','findOne','map','options','getFields','getSubjects','getDescriptions','ServicenowField','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x1c4866,_0x255b66){var _0x4239e6=function(_0xb477fe){while(--_0xb477fe){_0x1c4866['push'](_0x1c4866['shift']());}};_0x4239e6(++_0x255b66);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5a19fc,_0x58f9f4){_0x5a19fc=_0x5a19fc-0x0;var _0x34b413=_0x5fc3[_0x5a19fc];return _0x34b413;};'use strict';var pdf=require(_0x35fc('0x0'));var emlformat=require(_0x35fc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x35fc('0x2'));var jsonpatch=require(_0x35fc('0x3'));var rp=require(_0x35fc('0x4'));var moment=require(_0x35fc('0x5'));var BPromise=require(_0x35fc('0x6'));var Mustache=require('mustache');var util=require(_0x35fc('0x7'));var path=require(_0x35fc('0x8'));var sox=require(_0x35fc('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0xe'));var querystring=require(_0x35fc('0xf'));var Papa=require(_0x35fc('0x10'));var Redis=require(_0x35fc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x12'));var hardwareService=require(_0x35fc('0x13'));var logger=require('../../config/logger')(_0x35fc('0x14'));var utils=require(_0x35fc('0x15'));var config=require('../../config/environment');var db=require(_0x35fc('0x16'))['db'];var jayson=require(_0x35fc('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x409357,_0x5d462a,_0x397738){if(_0x397738){var _0x22055e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x22055e[_0x35fc('0x18')](_0x5d462a)){return _0x409357;}else{throw new Error(_0x35fc('0x19'));}}else{return _0x409357;}}function respondWithRpcPromise(_0x38d9f2,_0x5cfe94,_0x59507a,_0x5eac0f){return new BPromise(function(_0x558364,_0x398b67){var _0x229d56=_0x5eac0f||client;return _0x229d56[_0x35fc('0x1a')](_0x38d9f2,_0x59507a)[_0x35fc('0x1b')](function(_0x227a49){logger[_0x35fc('0x1c')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5cfe94,_0x35fc('0x1d'));logger[_0x35fc('0x1e')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x5cfe94,_0x35fc('0x1d'),JSON[_0x35fc('0x1f')](_0x227a49));if(_0x227a49[_0x35fc('0x20')]){if(_0x227a49['error'][_0x35fc('0x21')]===0x1f4){logger[_0x35fc('0x20')](_0x35fc('0x22'),_0x5cfe94,_0x227a49['error'][_0x35fc('0x23')]);return _0x398b67(_0x227a49[_0x35fc('0x20')][_0x35fc('0x23')]);}logger[_0x35fc('0x20')](_0x35fc('0x22'),_0x5cfe94,_0x227a49[_0x35fc('0x20')][_0x35fc('0x23')]);return _0x558364(_0x227a49[_0x35fc('0x20')][_0x35fc('0x23')]);}else{logger[_0x35fc('0x1c')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5cfe94,_0x35fc('0x1d'));_0x558364(_0x227a49[_0x35fc('0x24')][_0x35fc('0x23')]);}})[_0x35fc('0x25')](function(_0x3b4743){logger['error'](_0x35fc('0x22'),_0x5cfe94,_0x3b4743);_0x398b67(_0x3b4743);});});}function respondWithStatusCode(_0x4c587a,_0x561bf8){_0x561bf8=_0x561bf8||0xcc;return function(_0x265324){if(_0x265324){return _0x4c587a[_0x35fc('0x26')](_0x561bf8);}return _0x4c587a[_0x35fc('0x27')](_0x561bf8)['end']();};}function respondWithResult(_0x4086e9,_0x598d7a){_0x598d7a=_0x598d7a||0xc8;return function(_0x1bf180){if(_0x1bf180){return _0x4086e9[_0x35fc('0x27')](_0x598d7a)['json'](_0x1bf180);}};}function respondWithFilteredResult(_0x519264,_0x47774c){return function(_0x58edb6){if(_0x58edb6){var _0x274208=_0x58edb6[_0x35fc('0x28')],_0x1a5d92=_0x47774c[_0x35fc('0x29')],_0x57001c=_0x47774c[_0x35fc('0x29')]+_0x47774c[_0x35fc('0x2a')],_0x26b7cb;if(_0x57001c>=_0x274208){_0x57001c=_0x274208;_0x26b7cb=0xc8;}else{_0x26b7cb=0xce;}_0x519264[_0x35fc('0x27')](_0x26b7cb);return _0x519264[_0x35fc('0x2b')](_0x35fc('0x2c'),_0x1a5d92+'-'+_0x57001c+'/'+_0x274208)['json'](_0x58edb6);}return null;};}function patchUpdates(_0x1cd1ae){return function(_0x220931){try{jsonpatch[_0x35fc('0x2d')](_0x220931,_0x1cd1ae,!![]);}catch(_0x52acc5){return BPromise[_0x35fc('0x2e')](_0x52acc5);}return _0x220931[_0x35fc('0x2f')]();};}function saveUpdates(_0x3822a8,_0xe6e4ba){return function(_0xd8a4ca){if(_0xd8a4ca){return _0xd8a4ca[_0x35fc('0x30')](_0x3822a8)[_0x35fc('0x1b')](function(_0x37b435){return _0x37b435;});}return null;};}function removeEntity(_0xf4dfab,_0x127bfc){return function(_0x57072d){if(_0x57072d){return _0x57072d['destroy']()[_0x35fc('0x1b')](function(){_0xf4dfab['status'](0xcc)[_0x35fc('0x31')]();});}};}function handleEntityNotFound(_0x39454e,_0x1c4b8b){return function(_0x227471){if(!_0x227471){_0x39454e[_0x35fc('0x26')](0x194);}return _0x227471;};}function handleError(_0x12e78f,_0x4e43b4){_0x4e43b4=_0x4e43b4||0x1f4;return function(_0x3fe193){logger[_0x35fc('0x20')](_0x3fe193[_0x35fc('0x32')]);if(_0x3fe193[_0x35fc('0x33')]){delete _0x3fe193[_0x35fc('0x33')];}_0x12e78f[_0x35fc('0x27')](_0x4e43b4)['send'](_0x3fe193);};}exports[_0x35fc('0x34')]=function(_0x38193d,_0x1fecdf){var _0x52f53d={},_0x2c657d={},_0x48d223={'count':0x0,'rows':[]};var _0x2ecb2e=db[_0x35fc('0x35')][_0x35fc('0x36')];_0x2c657d[_0x35fc('0x37')]=_['keys'](_0x2ecb2e);_0x2c657d['query']=_['keys'](_0x38193d[_0x35fc('0x38')]);_0x2c657d['filters']=_[_0x35fc('0x39')](_0x2c657d['model'],_0x2c657d[_0x35fc('0x38')]);_0x52f53d[_0x35fc('0x3a')]=_[_0x35fc('0x39')](_0x2c657d[_0x35fc('0x37')],qs[_0x35fc('0x3b')](_0x38193d[_0x35fc('0x38')][_0x35fc('0x3b')]));_0x52f53d['attributes']=_0x52f53d[_0x35fc('0x3a')][_0x35fc('0x3c')]?_0x52f53d['attributes']:_0x2c657d[_0x35fc('0x37')];if(!_0x38193d[_0x35fc('0x38')][_0x35fc('0x3d')](_0x35fc('0x3e'))){_0x52f53d[_0x35fc('0x2a')]=qs[_0x35fc('0x2a')](_0x38193d['query'][_0x35fc('0x2a')]);_0x52f53d[_0x35fc('0x29')]=qs[_0x35fc('0x29')](_0x38193d['query'][_0x35fc('0x29')]);}_0x52f53d[_0x35fc('0x3f')]=qs['sort'](_0x38193d[_0x35fc('0x38')][_0x35fc('0x40')]);_0x52f53d[_0x35fc('0x41')]=qs[_0x35fc('0x42')](_[_0x35fc('0x43')](_0x38193d[_0x35fc('0x38')],_0x2c657d[_0x35fc('0x42')]));if(_0x38193d[_0x35fc('0x38')]['filter']){_0x52f53d['where']=_[_0x35fc('0x44')](_0x52f53d[_0x35fc('0x41')],{'$or':_['map'](_0x2ecb2e,function(_0x5c2e5c){if(_0x5c2e5c['type'][_0x35fc('0x45')]!==_0x35fc('0x46')){var _0x4e56ed={};_0x4e56ed[_0x5c2e5c[_0x35fc('0x47')]]={'$like':'%'+_0x38193d[_0x35fc('0x38')][_0x35fc('0x48')]+'%'};return _0x4e56ed;}})});}_0x52f53d=_[_0x35fc('0x44')]({},_0x52f53d,_0x38193d['options']);var _0x57105c={'where':_0x52f53d['where']};return db['ServicenowConfiguration']['count'](_0x57105c)[_0x35fc('0x1b')](function(_0x27eabf){_0x48d223['count']=_0x27eabf;if(_0x38193d[_0x35fc('0x38')]['includeAll']){_0x52f53d[_0x35fc('0x49')]=[{'all':!![]}];}return db[_0x35fc('0x35')][_0x35fc('0x4a')](_0x52f53d);})[_0x35fc('0x1b')](function(_0x16f7c8){_0x48d223['rows']=_0x16f7c8;return _0x48d223;})[_0x35fc('0x1b')](respondWithFilteredResult(_0x1fecdf,_0x52f53d))[_0x35fc('0x25')](handleError(_0x1fecdf,null));};exports['show']=function(_0x18181b,_0x298b7b){var _0x2a8a09={'raw':![],'where':{'id':_0x18181b['params']['id']}},_0x211746={};_0x211746[_0x35fc('0x37')]=_['keys'](db['ServicenowConfiguration'][_0x35fc('0x36')]);_0x211746[_0x35fc('0x38')]=_[_0x35fc('0x4b')](_0x18181b[_0x35fc('0x38')]);_0x211746[_0x35fc('0x42')]=_[_0x35fc('0x39')](_0x211746[_0x35fc('0x37')],_0x211746[_0x35fc('0x38')]);_0x2a8a09['attributes']=_[_0x35fc('0x39')](_0x211746[_0x35fc('0x37')],qs[_0x35fc('0x3b')](_0x18181b[_0x35fc('0x38')][_0x35fc('0x3b')]));_0x2a8a09[_0x35fc('0x3a')]=_0x2a8a09[_0x35fc('0x3a')][_0x35fc('0x3c')]?_0x2a8a09[_0x35fc('0x3a')]:_0x211746[_0x35fc('0x37')];if(_0x18181b[_0x35fc('0x38')][_0x35fc('0x4c')]){_0x2a8a09[_0x35fc('0x49')]=[{'all':!![]}];}_0x2a8a09=_[_0x35fc('0x44')]({},_0x2a8a09,_0x18181b['options']);return db['ServicenowConfiguration'][_0x35fc('0x4d')](_0x2a8a09)[_0x35fc('0x1b')](handleEntityNotFound(_0x298b7b,null))[_0x35fc('0x1b')](respondWithResult(_0x298b7b,null))[_0x35fc('0x25')](handleError(_0x298b7b,null));};exports[_0x35fc('0x4e')]=function(_0x3e6494,_0x4a4798){return db['ServicenowConfiguration'][_0x35fc('0x4e')](_0x3e6494[_0x35fc('0x4f')],{})[_0x35fc('0x1b')](respondWithResult(_0x4a4798,0xc9))[_0x35fc('0x25')](handleError(_0x4a4798,null));};exports['update']=function(_0x467980,_0x13281f){if(_0x467980['body']['id']){delete _0x467980[_0x35fc('0x4f')]['id'];}return db[_0x35fc('0x35')]['find']({'where':{'id':_0x467980[_0x35fc('0x50')]['id']}})[_0x35fc('0x1b')](handleEntityNotFound(_0x13281f,null))[_0x35fc('0x1b')](saveUpdates(_0x467980[_0x35fc('0x4f')],null))['then'](respondWithResult(_0x13281f,null))['catch'](handleError(_0x13281f,null));};exports['destroy']=function(_0x240338,_0x2ea8d6){return db['ServicenowConfiguration'][_0x35fc('0x4d')]({'where':{'id':_0x240338[_0x35fc('0x50')]['id']}})[_0x35fc('0x1b')](handleEntityNotFound(_0x2ea8d6,null))[_0x35fc('0x1b')](removeEntity(_0x2ea8d6,null))[_0x35fc('0x25')](handleError(_0x2ea8d6,null));};exports['getFields']=function(_0x2d9d45,_0x757aa6,_0x39d470){var _0x509e77={};var _0x304dba={};var _0x1dbf5a;var _0x47fb1a;return db[_0x35fc('0x35')][_0x35fc('0x51')]({'where':{'id':_0x2d9d45[_0x35fc('0x50')]['id']}})[_0x35fc('0x1b')](handleEntityNotFound(_0x757aa6,null))[_0x35fc('0x1b')](function(_0x41453b){if(_0x41453b){_0x1dbf5a=_0x41453b;_0x304dba[_0x35fc('0x37')]=_[_0x35fc('0x4b')](db['ServicenowField'][_0x35fc('0x36')]);_0x304dba[_0x35fc('0x38')]=_[_0x35fc('0x4b')](_0x2d9d45['query']);_0x304dba[_0x35fc('0x42')]=_['intersection'](_0x304dba['model'],_0x304dba['query']);_0x509e77[_0x35fc('0x3a')]=_[_0x35fc('0x39')](_0x304dba[_0x35fc('0x37')],qs[_0x35fc('0x3b')](_0x2d9d45[_0x35fc('0x38')]['fields']));_0x509e77['attributes']=_0x509e77['attributes']['length']?_0x509e77['attributes']:_0x304dba[_0x35fc('0x37')];_0x509e77[_0x35fc('0x3f')]=qs[_0x35fc('0x40')](_0x2d9d45[_0x35fc('0x38')]['sort']);_0x509e77[_0x35fc('0x41')]=qs[_0x35fc('0x42')](_[_0x35fc('0x43')](_0x2d9d45[_0x35fc('0x38')],_0x304dba[_0x35fc('0x42')]));if(_0x2d9d45[_0x35fc('0x38')][_0x35fc('0x48')]){_0x509e77[_0x35fc('0x41')]=_[_0x35fc('0x44')](_0x509e77['where'],{'$or':_[_0x35fc('0x52')](_0x509e77['attributes'],function(_0xfbd737){var _0x9029e3={};_0x9029e3[_0xfbd737]={'$like':'%'+_0x2d9d45[_0x35fc('0x38')][_0x35fc('0x48')]+'%'};return _0x9029e3;})});}_0x509e77=_['merge']({},_0x509e77,_0x2d9d45[_0x35fc('0x53')]);return _0x1dbf5a['getFields'](_0x509e77);}})['then'](function(_0x5f1d4a){if(_0x5f1d4a){_0x47fb1a=_0x5f1d4a[_0x35fc('0x3c')];if(!_0x2d9d45['query'][_0x35fc('0x3d')]('nolimit')){_0x509e77[_0x35fc('0x2a')]=qs['limit'](_0x2d9d45[_0x35fc('0x38')][_0x35fc('0x2a')]);_0x509e77[_0x35fc('0x29')]=qs[_0x35fc('0x29')](_0x2d9d45['query'][_0x35fc('0x29')]);}return _0x1dbf5a[_0x35fc('0x54')](_0x509e77);}})[_0x35fc('0x1b')](function(_0x5df92d){if(_0x5df92d){return _0x5df92d?{'count':_0x47fb1a,'rows':_0x5df92d}:null;}})[_0x35fc('0x1b')](respondWithResult(_0x757aa6,null))[_0x35fc('0x25')](handleError(_0x757aa6,null));};exports[_0x35fc('0x55')]=function(_0x3c1b56,_0x1e4e15,_0x2c4309){var _0x2ee98b={};var _0x4464d5={};var _0x5159a0;var _0x28a44b;return db[_0x35fc('0x35')][_0x35fc('0x51')]({'where':{'id':_0x3c1b56['params']['id']}})[_0x35fc('0x1b')](handleEntityNotFound(_0x1e4e15,null))[_0x35fc('0x1b')](function(_0x586729){if(_0x586729){_0x5159a0=_0x586729;_0x4464d5['model']=_[_0x35fc('0x4b')](db['ServicenowField'][_0x35fc('0x36')]);_0x4464d5[_0x35fc('0x38')]=_[_0x35fc('0x4b')](_0x3c1b56[_0x35fc('0x38')]);_0x4464d5[_0x35fc('0x42')]=_[_0x35fc('0x39')](_0x4464d5[_0x35fc('0x37')],_0x4464d5[_0x35fc('0x38')]);_0x2ee98b[_0x35fc('0x3a')]=_[_0x35fc('0x39')](_0x4464d5[_0x35fc('0x37')],qs[_0x35fc('0x3b')](_0x3c1b56[_0x35fc('0x38')][_0x35fc('0x3b')]));_0x2ee98b[_0x35fc('0x3a')]=_0x2ee98b[_0x35fc('0x3a')][_0x35fc('0x3c')]?_0x2ee98b[_0x35fc('0x3a')]:_0x4464d5[_0x35fc('0x37')];_0x2ee98b[_0x35fc('0x3f')]=qs['sort'](_0x3c1b56[_0x35fc('0x38')]['sort']);_0x2ee98b[_0x35fc('0x41')]=qs[_0x35fc('0x42')](_[_0x35fc('0x43')](_0x3c1b56[_0x35fc('0x38')],_0x4464d5[_0x35fc('0x42')]));if(_0x3c1b56[_0x35fc('0x38')][_0x35fc('0x48')]){_0x2ee98b[_0x35fc('0x41')]=_[_0x35fc('0x44')](_0x2ee98b[_0x35fc('0x41')],{'$or':_[_0x35fc('0x52')](_0x2ee98b['attributes'],function(_0x446e87){var _0x4657de={};_0x4657de[_0x446e87]={'$like':'%'+_0x3c1b56[_0x35fc('0x38')][_0x35fc('0x48')]+'%'};return _0x4657de;})});}_0x2ee98b=_[_0x35fc('0x44')]({},_0x2ee98b,_0x3c1b56[_0x35fc('0x53')]);return _0x5159a0['getSubjects'](_0x2ee98b);}})[_0x35fc('0x1b')](function(_0x3353e0){if(_0x3353e0){_0x28a44b=_0x3353e0[_0x35fc('0x3c')];if(!_0x3c1b56[_0x35fc('0x38')][_0x35fc('0x3d')](_0x35fc('0x3e'))){_0x2ee98b[_0x35fc('0x2a')]=qs[_0x35fc('0x2a')](_0x3c1b56[_0x35fc('0x38')]['limit']);_0x2ee98b[_0x35fc('0x29')]=qs['offset'](_0x3c1b56[_0x35fc('0x38')][_0x35fc('0x29')]);}return _0x5159a0['getSubjects'](_0x2ee98b);}})[_0x35fc('0x1b')](function(_0x41002a){if(_0x41002a){return _0x41002a?{'count':_0x28a44b,'rows':_0x41002a}:null;}})[_0x35fc('0x1b')](respondWithResult(_0x1e4e15,null))[_0x35fc('0x25')](handleError(_0x1e4e15,null));};exports[_0x35fc('0x56')]=function(_0x1a765f,_0x42f87e,_0x452c10){var _0x25ee61={};var _0x5806bf={};var _0x4c70e2;var _0x4e7c7b;return db['ServicenowConfiguration'][_0x35fc('0x51')]({'where':{'id':_0x1a765f[_0x35fc('0x50')]['id']}})[_0x35fc('0x1b')](handleEntityNotFound(_0x42f87e,null))[_0x35fc('0x1b')](function(_0x35ef53){if(_0x35ef53){_0x4c70e2=_0x35ef53;_0x5806bf['model']=_[_0x35fc('0x4b')](db[_0x35fc('0x57')][_0x35fc('0x36')]);_0x5806bf[_0x35fc('0x38')]=_['keys'](_0x1a765f[_0x35fc('0x38')]);_0x5806bf[_0x35fc('0x42')]=_[_0x35fc('0x39')](_0x5806bf['model'],_0x5806bf[_0x35fc('0x38')]);_0x25ee61[_0x35fc('0x3a')]=_[_0x35fc('0x39')](_0x5806bf[_0x35fc('0x37')],qs[_0x35fc('0x3b')](_0x1a765f[_0x35fc('0x38')][_0x35fc('0x3b')]));_0x25ee61[_0x35fc('0x3a')]=_0x25ee61['attributes'][_0x35fc('0x3c')]?_0x25ee61[_0x35fc('0x3a')]:_0x5806bf[_0x35fc('0x37')];_0x25ee61[_0x35fc('0x3f')]=qs[_0x35fc('0x40')](_0x1a765f[_0x35fc('0x38')]['sort']);_0x25ee61[_0x35fc('0x41')]=qs['filters'](_['pick'](_0x1a765f[_0x35fc('0x38')],_0x5806bf['filters']));if(_0x1a765f[_0x35fc('0x38')][_0x35fc('0x48')]){_0x25ee61[_0x35fc('0x41')]=_['merge'](_0x25ee61[_0x35fc('0x41')],{'$or':_[_0x35fc('0x52')](_0x25ee61[_0x35fc('0x3a')],function(_0x1beb46){var _0x21f7e6={};_0x21f7e6[_0x1beb46]={'$like':'%'+_0x1a765f['query']['filter']+'%'};return _0x21f7e6;})});}_0x25ee61=_['merge']({},_0x25ee61,_0x1a765f[_0x35fc('0x53')]);return _0x4c70e2['getDescriptions'](_0x25ee61);}})[_0x35fc('0x1b')](function(_0x1824c2){if(_0x1824c2){_0x4e7c7b=_0x1824c2[_0x35fc('0x3c')];if(!_0x1a765f[_0x35fc('0x38')]['hasOwnProperty'](_0x35fc('0x3e'))){_0x25ee61[_0x35fc('0x2a')]=qs[_0x35fc('0x2a')](_0x1a765f['query'][_0x35fc('0x2a')]);_0x25ee61[_0x35fc('0x29')]=qs[_0x35fc('0x29')](_0x1a765f['query']['offset']);}return _0x4c70e2['getDescriptions'](_0x25ee61);}})[_0x35fc('0x1b')](function(_0x2edb1b){if(_0x2edb1b){return _0x2edb1b?{'count':_0x4e7c7b,'rows':_0x2edb1b}:null;}})[_0x35fc('0x1b')](respondWithResult(_0x42f87e,null))[_0x35fc('0x25')](handleError(_0x42f87e,null));};
\ No newline at end of file
+var _0x1261=['util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../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','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','Content-Range','reject','save','update','name','send','ServicenowConfiguration','keys','query','intersection','attributes','model','fields','length','nolimit','limit','order','sort','filter','where','merge','type','key','options','includeAll','rows','params','include','find','create','body','destroy','getFields','findOne','ServicenowField','rawAttributes','filters','pick','map','hasOwnProperty','getSubjects','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x55f816,_0x23785d){var _0x4aa549=function(_0xcb75c){while(--_0xcb75c){_0x55f816['push'](_0x55f816['shift']());}};_0x4aa549(++_0x23785d);}(_0x1261,0x144));var _0x1126=function(_0xf973b7,_0x46699f){_0xf973b7=_0xf973b7-0x0;var _0x499087=_0x1261[_0xf973b7];return _0x499087;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require(_0x1126('0x2'));var jsonpatch=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var moment=require(_0x1126('0x5'));var BPromise=require(_0x1126('0x6'));var Mustache=require(_0x1126('0x7'));var util=require(_0x1126('0x8'));var path=require(_0x1126('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1126('0xa'));var fs=require('fs');var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1126('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x1126('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x1126('0x16'));var client=jayson[_0x1126('0x17')][_0x1126('0x18')]({'port':0x232a});function checkPasswordPattern(_0x273896,_0xca0355,_0x3f10e9){if(_0x3f10e9){var _0xd8ca42=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xd8ca42[_0x1126('0x19')](_0xca0355)){return _0x273896;}else{throw new Error(_0x1126('0x1a'));}}else{return _0x273896;}}function respondWithRpcPromise(_0x53a8f0,_0x5de9a7,_0x1af673,_0x154e20){return new BPromise(function(_0x279455,_0x4be0c6){var _0x45149c=_0x154e20||client;return _0x45149c['request'](_0x53a8f0,_0x1af673)[_0x1126('0x1b')](function(_0x42f379){logger[_0x1126('0x1c')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5de9a7,_0x1126('0x1d'));logger[_0x1126('0x1e')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x5de9a7,'request\x20sent',JSON[_0x1126('0x1f')](_0x42f379));if(_0x42f379[_0x1126('0x20')]){if(_0x42f379['error']['code']===0x1f4){logger[_0x1126('0x20')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5de9a7,_0x42f379[_0x1126('0x20')][_0x1126('0x21')]);return _0x4be0c6(_0x42f379[_0x1126('0x20')]['message']);}logger[_0x1126('0x20')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5de9a7,_0x42f379['error'][_0x1126('0x21')]);return _0x279455(_0x42f379[_0x1126('0x20')][_0x1126('0x21')]);}else{logger[_0x1126('0x1c')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5de9a7,_0x1126('0x1d'));_0x279455(_0x42f379[_0x1126('0x22')]['message']);}})[_0x1126('0x23')](function(_0x59cd8e){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x5de9a7,_0x59cd8e);_0x4be0c6(_0x59cd8e);});});}function respondWithStatusCode(_0x2199d9,_0x15bcc3){_0x15bcc3=_0x15bcc3||0xcc;return function(_0x329914){if(_0x329914){return _0x2199d9[_0x1126('0x24')](_0x15bcc3);}return _0x2199d9[_0x1126('0x25')](_0x15bcc3)[_0x1126('0x26')]();};}function respondWithResult(_0xea0971,_0x38119d){_0x38119d=_0x38119d||0xc8;return function(_0x589725){if(_0x589725){return _0xea0971[_0x1126('0x25')](_0x38119d)[_0x1126('0x27')](_0x589725);}};}function respondWithFilteredResult(_0xa293f4,_0x5ddf63){return function(_0x541bc9){if(_0x541bc9){var _0xeb7d89=_0x541bc9[_0x1126('0x28')],_0x39bf0e=_0x5ddf63['offset'],_0x55e195=_0x5ddf63[_0x1126('0x29')]+_0x5ddf63['limit'],_0x2fb797;if(_0x55e195>=_0xeb7d89){_0x55e195=_0xeb7d89;_0x2fb797=0xc8;}else{_0x2fb797=0xce;}_0xa293f4[_0x1126('0x25')](_0x2fb797);return _0xa293f4['set'](_0x1126('0x2a'),_0x39bf0e+'-'+_0x55e195+'/'+_0xeb7d89)['json'](_0x541bc9);}return null;};}function patchUpdates(_0x378f4d){return function(_0x5f2611){try{jsonpatch['apply'](_0x5f2611,_0x378f4d,!![]);}catch(_0x4a53ab){return BPromise[_0x1126('0x2b')](_0x4a53ab);}return _0x5f2611[_0x1126('0x2c')]();};}function saveUpdates(_0x1cef48,_0x5b8bea){return function(_0x2a3055){if(_0x2a3055){return _0x2a3055[_0x1126('0x2d')](_0x1cef48)['then'](function(_0x3dd50e){return _0x3dd50e;});}return null;};}function removeEntity(_0x1e80aa,_0x2d8127){return function(_0x29fbfa){if(_0x29fbfa){return _0x29fbfa['destroy']()['then'](function(){_0x1e80aa[_0x1126('0x25')](0xcc)[_0x1126('0x26')]();});}};}function handleEntityNotFound(_0x2d9bd2,_0x2c67eb){return function(_0x55244a){if(!_0x55244a){_0x2d9bd2[_0x1126('0x24')](0x194);}return _0x55244a;};}function handleError(_0x6f4312,_0x313ebe){_0x313ebe=_0x313ebe||0x1f4;return function(_0x22436c){logger[_0x1126('0x20')](_0x22436c['stack']);if(_0x22436c[_0x1126('0x2e')]){delete _0x22436c[_0x1126('0x2e')];}_0x6f4312[_0x1126('0x25')](_0x313ebe)[_0x1126('0x2f')](_0x22436c);};}exports['index']=function(_0x4ca51c,_0x22827a){var _0x31d07c={},_0x511e6b={},_0xde37cf={'count':0x0,'rows':[]};var _0xf3c21b=db[_0x1126('0x30')]['rawAttributes'];_0x511e6b['model']=_[_0x1126('0x31')](_0xf3c21b);_0x511e6b[_0x1126('0x32')]=_[_0x1126('0x31')](_0x4ca51c[_0x1126('0x32')]);_0x511e6b['filters']=_[_0x1126('0x33')](_0x511e6b['model'],_0x511e6b[_0x1126('0x32')]);_0x31d07c[_0x1126('0x34')]=_[_0x1126('0x33')](_0x511e6b[_0x1126('0x35')],qs[_0x1126('0x36')](_0x4ca51c['query'][_0x1126('0x36')]));_0x31d07c[_0x1126('0x34')]=_0x31d07c[_0x1126('0x34')][_0x1126('0x37')]?_0x31d07c[_0x1126('0x34')]:_0x511e6b[_0x1126('0x35')];if(!_0x4ca51c[_0x1126('0x32')]['hasOwnProperty'](_0x1126('0x38'))){_0x31d07c[_0x1126('0x39')]=qs[_0x1126('0x39')](_0x4ca51c[_0x1126('0x32')][_0x1126('0x39')]);_0x31d07c['offset']=qs['offset'](_0x4ca51c[_0x1126('0x32')][_0x1126('0x29')]);}_0x31d07c[_0x1126('0x3a')]=qs[_0x1126('0x3b')](_0x4ca51c[_0x1126('0x32')][_0x1126('0x3b')]);_0x31d07c['where']=qs['filters'](_['pick'](_0x4ca51c[_0x1126('0x32')],_0x511e6b['filters']));if(_0x4ca51c[_0x1126('0x32')][_0x1126('0x3c')]){_0x31d07c[_0x1126('0x3d')]=_[_0x1126('0x3e')](_0x31d07c['where'],{'$or':_['map'](_0xf3c21b,function(_0x353042){if(_0x353042[_0x1126('0x3f')][_0x1126('0x40')]!=='VIRTUAL'){var _0x2f8551={};_0x2f8551[_0x353042['field']]={'$like':'%'+_0x4ca51c[_0x1126('0x32')]['filter']+'%'};return _0x2f8551;}})});}_0x31d07c=_[_0x1126('0x3e')]({},_0x31d07c,_0x4ca51c[_0x1126('0x41')]);var _0x1006fb={'where':_0x31d07c['where']};return db[_0x1126('0x30')][_0x1126('0x28')](_0x1006fb)[_0x1126('0x1b')](function(_0x48c694){_0xde37cf['count']=_0x48c694;if(_0x4ca51c['query'][_0x1126('0x42')]){_0x31d07c['include']=[{'all':!![]}];}return db[_0x1126('0x30')]['findAll'](_0x31d07c);})[_0x1126('0x1b')](function(_0x323499){_0xde37cf[_0x1126('0x43')]=_0x323499;return _0xde37cf;})[_0x1126('0x1b')](respondWithFilteredResult(_0x22827a,_0x31d07c))[_0x1126('0x23')](handleError(_0x22827a,null));};exports['show']=function(_0x198173,_0x512f60){var _0x5111d3={'raw':![],'where':{'id':_0x198173[_0x1126('0x44')]['id']}},_0x1a15f8={};_0x1a15f8['model']=_[_0x1126('0x31')](db[_0x1126('0x30')]['rawAttributes']);_0x1a15f8[_0x1126('0x32')]=_[_0x1126('0x31')](_0x198173[_0x1126('0x32')]);_0x1a15f8['filters']=_[_0x1126('0x33')](_0x1a15f8[_0x1126('0x35')],_0x1a15f8[_0x1126('0x32')]);_0x5111d3[_0x1126('0x34')]=_[_0x1126('0x33')](_0x1a15f8[_0x1126('0x35')],qs[_0x1126('0x36')](_0x198173[_0x1126('0x32')]['fields']));_0x5111d3[_0x1126('0x34')]=_0x5111d3['attributes'][_0x1126('0x37')]?_0x5111d3[_0x1126('0x34')]:_0x1a15f8['model'];if(_0x198173['query'][_0x1126('0x42')]){_0x5111d3[_0x1126('0x45')]=[{'all':!![]}];}_0x5111d3=_[_0x1126('0x3e')]({},_0x5111d3,_0x198173['options']);return db[_0x1126('0x30')][_0x1126('0x46')](_0x5111d3)[_0x1126('0x1b')](handleEntityNotFound(_0x512f60,null))[_0x1126('0x1b')](respondWithResult(_0x512f60,null))['catch'](handleError(_0x512f60,null));};exports[_0x1126('0x47')]=function(_0x46551f,_0x5c36b9){return db['ServicenowConfiguration']['create'](_0x46551f['body'],{})[_0x1126('0x1b')](respondWithResult(_0x5c36b9,0xc9))[_0x1126('0x23')](handleError(_0x5c36b9,null));};exports['update']=function(_0x16552b,_0x1c7a2b){if(_0x16552b[_0x1126('0x48')]['id']){delete _0x16552b[_0x1126('0x48')]['id'];}return db[_0x1126('0x30')]['find']({'where':{'id':_0x16552b[_0x1126('0x44')]['id']}})[_0x1126('0x1b')](handleEntityNotFound(_0x1c7a2b,null))['then'](saveUpdates(_0x16552b[_0x1126('0x48')],null))[_0x1126('0x1b')](respondWithResult(_0x1c7a2b,null))[_0x1126('0x23')](handleError(_0x1c7a2b,null));};exports[_0x1126('0x49')]=function(_0xc8a0f,_0x59c3d0){return db[_0x1126('0x30')]['find']({'where':{'id':_0xc8a0f[_0x1126('0x44')]['id']}})[_0x1126('0x1b')](handleEntityNotFound(_0x59c3d0,null))[_0x1126('0x1b')](removeEntity(_0x59c3d0,null))['catch'](handleError(_0x59c3d0,null));};exports[_0x1126('0x4a')]=function(_0x2340f8,_0x5763b4,_0x30812d){var _0x25038f={};var _0x9bad53={};var _0x5a5340;var _0x2fe6dc;return db[_0x1126('0x30')][_0x1126('0x4b')]({'where':{'id':_0x2340f8[_0x1126('0x44')]['id']}})[_0x1126('0x1b')](handleEntityNotFound(_0x5763b4,null))[_0x1126('0x1b')](function(_0x30c848){if(_0x30c848){_0x5a5340=_0x30c848;_0x9bad53[_0x1126('0x35')]=_['keys'](db[_0x1126('0x4c')][_0x1126('0x4d')]);_0x9bad53[_0x1126('0x32')]=_[_0x1126('0x31')](_0x2340f8[_0x1126('0x32')]);_0x9bad53['filters']=_[_0x1126('0x33')](_0x9bad53[_0x1126('0x35')],_0x9bad53['query']);_0x25038f[_0x1126('0x34')]=_['intersection'](_0x9bad53[_0x1126('0x35')],qs[_0x1126('0x36')](_0x2340f8['query'][_0x1126('0x36')]));_0x25038f[_0x1126('0x34')]=_0x25038f[_0x1126('0x34')]['length']?_0x25038f[_0x1126('0x34')]:_0x9bad53['model'];_0x25038f['order']=qs[_0x1126('0x3b')](_0x2340f8[_0x1126('0x32')][_0x1126('0x3b')]);_0x25038f[_0x1126('0x3d')]=qs[_0x1126('0x4e')](_[_0x1126('0x4f')](_0x2340f8[_0x1126('0x32')],_0x9bad53['filters']));if(_0x2340f8[_0x1126('0x32')][_0x1126('0x3c')]){_0x25038f[_0x1126('0x3d')]=_[_0x1126('0x3e')](_0x25038f[_0x1126('0x3d')],{'$or':_[_0x1126('0x50')](_0x25038f['attributes'],function(_0x5b17d6){var _0x16a343={};_0x16a343[_0x5b17d6]={'$like':'%'+_0x2340f8[_0x1126('0x32')]['filter']+'%'};return _0x16a343;})});}_0x25038f=_['merge']({},_0x25038f,_0x2340f8['options']);return _0x5a5340['getFields'](_0x25038f);}})[_0x1126('0x1b')](function(_0x37b1ab){if(_0x37b1ab){_0x2fe6dc=_0x37b1ab[_0x1126('0x37')];if(!_0x2340f8['query'][_0x1126('0x51')](_0x1126('0x38'))){_0x25038f[_0x1126('0x39')]=qs[_0x1126('0x39')](_0x2340f8[_0x1126('0x32')][_0x1126('0x39')]);_0x25038f[_0x1126('0x29')]=qs['offset'](_0x2340f8[_0x1126('0x32')][_0x1126('0x29')]);}return _0x5a5340[_0x1126('0x4a')](_0x25038f);}})[_0x1126('0x1b')](function(_0x288b9b){if(_0x288b9b){return _0x288b9b?{'count':_0x2fe6dc,'rows':_0x288b9b}:null;}})['then'](respondWithResult(_0x5763b4,null))['catch'](handleError(_0x5763b4,null));};exports[_0x1126('0x52')]=function(_0x2643d7,_0x4f1b61,_0x3bf25d){var _0x1fb2f0={};var _0x366675={};var _0x6a41c0;var _0x2828d4;return db[_0x1126('0x30')][_0x1126('0x4b')]({'where':{'id':_0x2643d7[_0x1126('0x44')]['id']}})[_0x1126('0x1b')](handleEntityNotFound(_0x4f1b61,null))[_0x1126('0x1b')](function(_0x16e48a){if(_0x16e48a){_0x6a41c0=_0x16e48a;_0x366675[_0x1126('0x35')]=_[_0x1126('0x31')](db['ServicenowField'][_0x1126('0x4d')]);_0x366675[_0x1126('0x32')]=_[_0x1126('0x31')](_0x2643d7['query']);_0x366675['filters']=_[_0x1126('0x33')](_0x366675[_0x1126('0x35')],_0x366675[_0x1126('0x32')]);_0x1fb2f0[_0x1126('0x34')]=_['intersection'](_0x366675['model'],qs['fields'](_0x2643d7[_0x1126('0x32')][_0x1126('0x36')]));_0x1fb2f0[_0x1126('0x34')]=_0x1fb2f0[_0x1126('0x34')]['length']?_0x1fb2f0[_0x1126('0x34')]:_0x366675['model'];_0x1fb2f0[_0x1126('0x3a')]=qs[_0x1126('0x3b')](_0x2643d7[_0x1126('0x32')][_0x1126('0x3b')]);_0x1fb2f0[_0x1126('0x3d')]=qs[_0x1126('0x4e')](_[_0x1126('0x4f')](_0x2643d7['query'],_0x366675[_0x1126('0x4e')]));if(_0x2643d7['query'][_0x1126('0x3c')]){_0x1fb2f0[_0x1126('0x3d')]=_['merge'](_0x1fb2f0[_0x1126('0x3d')],{'$or':_[_0x1126('0x50')](_0x1fb2f0['attributes'],function(_0x29daa6){var _0x1442ab={};_0x1442ab[_0x29daa6]={'$like':'%'+_0x2643d7['query']['filter']+'%'};return _0x1442ab;})});}_0x1fb2f0=_[_0x1126('0x3e')]({},_0x1fb2f0,_0x2643d7[_0x1126('0x41')]);return _0x6a41c0[_0x1126('0x52')](_0x1fb2f0);}})['then'](function(_0x4d007b){if(_0x4d007b){_0x2828d4=_0x4d007b['length'];if(!_0x2643d7[_0x1126('0x32')]['hasOwnProperty']('nolimit')){_0x1fb2f0[_0x1126('0x39')]=qs['limit'](_0x2643d7[_0x1126('0x32')][_0x1126('0x39')]);_0x1fb2f0['offset']=qs[_0x1126('0x29')](_0x2643d7[_0x1126('0x32')][_0x1126('0x29')]);}return _0x6a41c0[_0x1126('0x52')](_0x1fb2f0);}})[_0x1126('0x1b')](function(_0x5e9872){if(_0x5e9872){return _0x5e9872?{'count':_0x2828d4,'rows':_0x5e9872}:null;}})[_0x1126('0x1b')](respondWithResult(_0x4f1b61,null))[_0x1126('0x23')](handleError(_0x4f1b61,null));};exports['getDescriptions']=function(_0xd182b1,_0x2d6fcf,_0x2c0908){var _0x2af2d0={};var _0x2598a7={};var _0x2cf3b9;var _0x59512b;return db[_0x1126('0x30')][_0x1126('0x4b')]({'where':{'id':_0xd182b1[_0x1126('0x44')]['id']}})[_0x1126('0x1b')](handleEntityNotFound(_0x2d6fcf,null))[_0x1126('0x1b')](function(_0x2010a9){if(_0x2010a9){_0x2cf3b9=_0x2010a9;_0x2598a7[_0x1126('0x35')]=_[_0x1126('0x31')](db[_0x1126('0x4c')]['rawAttributes']);_0x2598a7[_0x1126('0x32')]=_[_0x1126('0x31')](_0xd182b1[_0x1126('0x32')]);_0x2598a7[_0x1126('0x4e')]=_[_0x1126('0x33')](_0x2598a7['model'],_0x2598a7[_0x1126('0x32')]);_0x2af2d0['attributes']=_['intersection'](_0x2598a7[_0x1126('0x35')],qs[_0x1126('0x36')](_0xd182b1['query']['fields']));_0x2af2d0[_0x1126('0x34')]=_0x2af2d0[_0x1126('0x34')][_0x1126('0x37')]?_0x2af2d0[_0x1126('0x34')]:_0x2598a7[_0x1126('0x35')];_0x2af2d0[_0x1126('0x3a')]=qs[_0x1126('0x3b')](_0xd182b1[_0x1126('0x32')][_0x1126('0x3b')]);_0x2af2d0['where']=qs[_0x1126('0x4e')](_[_0x1126('0x4f')](_0xd182b1[_0x1126('0x32')],_0x2598a7[_0x1126('0x4e')]));if(_0xd182b1[_0x1126('0x32')][_0x1126('0x3c')]){_0x2af2d0['where']=_[_0x1126('0x3e')](_0x2af2d0[_0x1126('0x3d')],{'$or':_[_0x1126('0x50')](_0x2af2d0[_0x1126('0x34')],function(_0x12cdc6){var _0x1796eb={};_0x1796eb[_0x12cdc6]={'$like':'%'+_0xd182b1[_0x1126('0x32')][_0x1126('0x3c')]+'%'};return _0x1796eb;})});}_0x2af2d0=_[_0x1126('0x3e')]({},_0x2af2d0,_0xd182b1[_0x1126('0x41')]);return _0x2cf3b9['getDescriptions'](_0x2af2d0);}})['then'](function(_0x271d7c){if(_0x271d7c){_0x59512b=_0x271d7c['length'];if(!_0xd182b1[_0x1126('0x32')]['hasOwnProperty'](_0x1126('0x38'))){_0x2af2d0['limit']=qs[_0x1126('0x39')](_0xd182b1['query']['limit']);_0x2af2d0['offset']=qs[_0x1126('0x29')](_0xd182b1[_0x1126('0x32')]['offset']);}return _0x2cf3b9['getDescriptions'](_0x2af2d0);}})[_0x1126('0x1b')](function(_0xe2f82d){if(_0xe2f82d){return _0xe2f82d?{'count':_0x59512b,'rows':_0xe2f82d}:null;}})[_0x1126('0x1b')](respondWithResult(_0x2d6fcf,null))['catch'](handleError(_0x2d6fcf,null));};
\ No newline at end of file