Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / api / intServicenowAccount / intServicenowAccount.controller.js
index 26956b6..c448e1a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbaf2=['sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','correlation_id','location','username','email','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','GET','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','statusCode','test','Wrong\x20credentials','boolean','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','save','update','then','destroy','end','sendStatus','name','send','index','map','ServicenowAccount','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','getConfigurations','findOne','ServicenowConfiguration','Subjects','channel','Descriptions','getDescriptions','ServicenowField','made_sla','hold_reason','subcategory','close_code','notify','incident_state','severity','category','caused_by','watch_list','sys_updated_on','approval_history','sys_updated_by','user_input','sys_created_on','state','calendar_stc','closed_at','delivery_plan','impact','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','delivery_task','assignment_group','business_stc','additional_assignee_list','description','sys_class_name','close_notes','follow_up','parent_incident'];(function(_0x4207a0,_0x476dae){var _0x2ab9c1=function(_0x22c51f){while(--_0x22c51f){_0x4207a0['push'](_0x4207a0['shift']());}};_0x2ab9c1(++_0x476dae);}(_0xbaf2,0x195));var _0x2baf=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xbaf2[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x2baf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2baf('0x1'));var jsonpatch=require(_0x2baf('0x2'));var rp=require('request-promise');var moment=require(_0x2baf('0x3'));var BPromise=require(_0x2baf('0x4'));var Mustache=require(_0x2baf('0x5'));var util=require(_0x2baf('0x6'));var path=require(_0x2baf('0x7'));var sox=require(_0x2baf('0x8'));var csv=require(_0x2baf('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2baf('0xa'));var _=require(_0x2baf('0xb'));var squel=require(_0x2baf('0xc'));var crypto=require(_0x2baf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2baf('0xe'));var toCsv=require(_0x2baf('0x9'));var querystring=require(_0x2baf('0xf'));var Papa=require(_0x2baf('0x10'));var Redis=require(_0x2baf('0x11'));var authService=require(_0x2baf('0x12'));var qs=require(_0x2baf('0x13'));var as=require(_0x2baf('0x14'));var hardwareService=require(_0x2baf('0x15'));var logger=require(_0x2baf('0x16'))('api');var utils=require(_0x2baf('0x17'));var config=require(_0x2baf('0x18'));var licenseUtil=require(_0x2baf('0x19'));var db=require(_0x2baf('0x1a'))['db'];var integrations=require(_0x2baf('0x1b'));function respondWithStatusCode(_0x117e2b,_0x1ebfdb){_0x1ebfdb=_0x1ebfdb||0xcc;return function(_0x506231){if(_0x506231){return _0x117e2b['sendStatus'](_0x1ebfdb);}return _0x117e2b[_0x2baf('0x1c')](_0x1ebfdb)['end']();};}function respondWithResult(_0x4af9a6,_0x1c0eef){_0x1c0eef=_0x1c0eef||0xc8;return function(_0x436f89){if(_0x436f89){return _0x4af9a6[_0x2baf('0x1c')](_0x1c0eef)[_0x2baf('0x1d')](_0x436f89);}};}function respondWithFilteredResult(_0x49b16a,_0x216ce4){return function(_0x41aebd){if(_0x41aebd){var _0x3c246f=typeof _0x216ce4[_0x2baf('0x1e')]===_0x2baf('0x1f')&&typeof _0x216ce4[_0x2baf('0x20')]===_0x2baf('0x1f');var _0xca8981=_0x41aebd[_0x2baf('0x21')];var _0x1b6dfb=_0x3c246f?0x0:_0x216ce4['offset'];var _0x30ff72=_0x3c246f?_0x41aebd[_0x2baf('0x21')]:_0x216ce4['offset']+_0x216ce4[_0x2baf('0x20')];var _0x295304;if(_0x30ff72>=_0xca8981){_0x30ff72=_0xca8981;_0x295304=0xc8;}else{_0x295304=0xce;}_0x49b16a[_0x2baf('0x1c')](_0x295304);return _0x49b16a[_0x2baf('0x22')]('Content-Range',_0x1b6dfb+'-'+_0x30ff72+'/'+_0xca8981)[_0x2baf('0x1d')](_0x41aebd);}return null;};}function patchUpdates(_0x2debb6){return function(_0x77987a){try{jsonpatch['apply'](_0x77987a,_0x2debb6,!![]);}catch(_0x22fad9){return BPromise['reject'](_0x22fad9);}return _0x77987a[_0x2baf('0x23')]();};}function saveUpdates(_0x5abbe1,_0x343580){return function(_0x1f2840){if(_0x1f2840){return _0x1f2840[_0x2baf('0x24')](_0x5abbe1)[_0x2baf('0x25')](function(_0x276293){return _0x276293;});}return null;};}function removeEntity(_0x409a3c,_0x1ce19c){return function(_0x1e01fd){if(_0x1e01fd){return _0x1e01fd[_0x2baf('0x26')]()['then'](function(){_0x409a3c[_0x2baf('0x1c')](0xcc)[_0x2baf('0x27')]();});}};}function handleEntityNotFound(_0x5c94be,_0x31bf3c){return function(_0x5ebcc9){if(!_0x5ebcc9){_0x5c94be[_0x2baf('0x28')](0x194);}return _0x5ebcc9;};}function handleError(_0x1d6580,_0x26e0a3){_0x26e0a3=_0x26e0a3||0x1f4;return function(_0x4c12c2){logger['error'](_0x4c12c2['stack']);if(_0x4c12c2['name']){delete _0x4c12c2[_0x2baf('0x29')];}_0x1d6580[_0x2baf('0x1c')](_0x26e0a3)[_0x2baf('0x2a')](_0x4c12c2);};}exports[_0x2baf('0x2b')]=function(_0x1a0c4d,_0x2fc90a){var _0x125e8e={},_0xe0704a={},_0x133b05={'count':0x0,'rows':[]};var _0x4bb5c0=_[_0x2baf('0x2c')](db[_0x2baf('0x2d')]['rawAttributes'],function(_0x2d4852){return{'name':_0x2d4852[_0x2baf('0x2e')],'type':_0x2d4852[_0x2baf('0x2f')]['key']};});_0xe0704a['model']=_[_0x2baf('0x2c')](_0x4bb5c0,'name');_0xe0704a[_0x2baf('0x30')]=_['keys'](_0x1a0c4d[_0x2baf('0x30')]);_0xe0704a[_0x2baf('0x31')]=_[_0x2baf('0x32')](_0xe0704a[_0x2baf('0x33')],_0xe0704a[_0x2baf('0x30')]);_0x125e8e[_0x2baf('0x34')]=_[_0x2baf('0x32')](_0xe0704a[_0x2baf('0x33')],qs['fields'](_0x1a0c4d[_0x2baf('0x30')][_0x2baf('0x35')]));_0x125e8e[_0x2baf('0x34')]=_0x125e8e[_0x2baf('0x34')][_0x2baf('0x36')]?_0x125e8e[_0x2baf('0x34')]:_0xe0704a['model'];if(!_0x1a0c4d[_0x2baf('0x30')][_0x2baf('0x37')](_0x2baf('0x38'))){_0x125e8e[_0x2baf('0x20')]=qs[_0x2baf('0x20')](_0x1a0c4d[_0x2baf('0x30')][_0x2baf('0x20')]);_0x125e8e[_0x2baf('0x1e')]=qs['offset'](_0x1a0c4d[_0x2baf('0x30')][_0x2baf('0x1e')]);}_0x125e8e[_0x2baf('0x39')]=qs[_0x2baf('0x3a')](_0x1a0c4d[_0x2baf('0x30')]['sort']);_0x125e8e[_0x2baf('0x3b')]=qs[_0x2baf('0x31')](_[_0x2baf('0x3c')](_0x1a0c4d[_0x2baf('0x30')],_0xe0704a[_0x2baf('0x31')]),_0x4bb5c0);if(_0x1a0c4d[_0x2baf('0x30')]['filter']){_0x125e8e['where']=_[_0x2baf('0x3d')](_0x125e8e[_0x2baf('0x3b')],{'$or':_[_0x2baf('0x2c')](_0x4bb5c0,function(_0x595518){if(_0x595518['type']!==_0x2baf('0x3e')){var _0x39f110={};_0x39f110[_0x595518[_0x2baf('0x29')]]={'$like':'%'+_0x1a0c4d[_0x2baf('0x30')][_0x2baf('0x3f')]+'%'};return _0x39f110;}})});}_0x125e8e=_[_0x2baf('0x3d')]({},_0x125e8e,_0x1a0c4d[_0x2baf('0x40')]);var _0x46717a={'where':_0x125e8e[_0x2baf('0x3b')]};return db['ServicenowAccount'][_0x2baf('0x21')](_0x46717a)[_0x2baf('0x25')](function(_0x515aea){_0x133b05[_0x2baf('0x21')]=_0x515aea;if(_0x1a0c4d['query'][_0x2baf('0x41')]){_0x125e8e[_0x2baf('0x42')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x2baf('0x43')](_0x125e8e);})[_0x2baf('0x25')](function(_0x539371){_0x133b05[_0x2baf('0x44')]=_0x539371;return _0x133b05;})['then'](respondWithFilteredResult(_0x2fc90a,_0x125e8e))[_0x2baf('0x45')](handleError(_0x2fc90a,null));};exports[_0x2baf('0x46')]=function(_0x3ed137,_0x59648b){var _0x4efe01={'raw':![],'where':{'id':_0x3ed137[_0x2baf('0x47')]['id']}},_0x322eb2={};_0x322eb2[_0x2baf('0x33')]=_[_0x2baf('0x48')](db[_0x2baf('0x2d')][_0x2baf('0x49')]);_0x322eb2[_0x2baf('0x30')]=_[_0x2baf('0x48')](_0x3ed137[_0x2baf('0x30')]);_0x322eb2[_0x2baf('0x31')]=_[_0x2baf('0x32')](_0x322eb2['model'],_0x322eb2[_0x2baf('0x30')]);_0x4efe01['attributes']=_[_0x2baf('0x32')](_0x322eb2['model'],qs[_0x2baf('0x35')](_0x3ed137[_0x2baf('0x30')][_0x2baf('0x35')]));_0x4efe01[_0x2baf('0x34')]=_0x4efe01['attributes'][_0x2baf('0x36')]?_0x4efe01[_0x2baf('0x34')]:_0x322eb2[_0x2baf('0x33')];if(_0x3ed137[_0x2baf('0x30')][_0x2baf('0x41')]){_0x4efe01[_0x2baf('0x42')]=[{'all':!![]}];}_0x4efe01=_[_0x2baf('0x3d')]({},_0x4efe01,_0x3ed137[_0x2baf('0x40')]);return db['ServicenowAccount'][_0x2baf('0x4a')](_0x4efe01)[_0x2baf('0x25')](handleEntityNotFound(_0x59648b,null))['then'](respondWithResult(_0x59648b,null))['catch'](handleError(_0x59648b,null));};exports[_0x2baf('0x4b')]=function(_0x1e101c,_0x4990a8){return db['ServicenowAccount']['create'](_0x1e101c[_0x2baf('0x4c')],{})['then'](respondWithResult(_0x4990a8,0xc9))[_0x2baf('0x45')](handleError(_0x4990a8,null));};exports['update']=function(_0x334b5c,_0x3626bb){if(_0x334b5c[_0x2baf('0x4c')]['id']){delete _0x334b5c['body']['id'];}return db['ServicenowAccount'][_0x2baf('0x4a')]({'where':{'id':_0x334b5c[_0x2baf('0x47')]['id']}})[_0x2baf('0x25')](handleEntityNotFound(_0x3626bb,null))[_0x2baf('0x25')](saveUpdates(_0x334b5c['body'],null))[_0x2baf('0x25')](respondWithResult(_0x3626bb,null))[_0x2baf('0x45')](handleError(_0x3626bb,null));};exports[_0x2baf('0x26')]=function(_0x164a3e,_0x6aed4c){return db['ServicenowAccount'][_0x2baf('0x4a')]({'where':{'id':_0x164a3e[_0x2baf('0x47')]['id']}})[_0x2baf('0x25')](handleEntityNotFound(_0x6aed4c,null))['then'](removeEntity(_0x6aed4c,null))['catch'](handleError(_0x6aed4c,null));};exports[_0x2baf('0x4d')]=function(_0x550dfb,_0x27e3d8,_0x51b11d){var _0xca894={};var _0x3bf459={};var _0x347d73;var _0x470bcf;return db['ServicenowAccount'][_0x2baf('0x4e')]({'where':{'id':_0x550dfb['params']['id']}})[_0x2baf('0x25')](handleEntityNotFound(_0x27e3d8,null))[_0x2baf('0x25')](function(_0x376679){if(_0x376679){_0x347d73=_0x376679;_0x3bf459[_0x2baf('0x33')]=_['keys'](db[_0x2baf('0x4f')][_0x2baf('0x49')]);_0x3bf459[_0x2baf('0x30')]=_[_0x2baf('0x48')](_0x550dfb[_0x2baf('0x30')]);_0x3bf459[_0x2baf('0x31')]=_['intersection'](_0x3bf459[_0x2baf('0x33')],_0x3bf459[_0x2baf('0x30')]);_0xca894[_0x2baf('0x34')]=_[_0x2baf('0x32')](_0x3bf459[_0x2baf('0x33')],qs[_0x2baf('0x35')](_0x550dfb[_0x2baf('0x30')]['fields']));_0xca894[_0x2baf('0x34')]=_0xca894[_0x2baf('0x34')][_0x2baf('0x36')]?_0xca894[_0x2baf('0x34')]:_0x3bf459[_0x2baf('0x33')];_0xca894['order']=qs['sort'](_0x550dfb[_0x2baf('0x30')]['sort']);_0xca894['where']=qs[_0x2baf('0x31')](_[_0x2baf('0x3c')](_0x550dfb[_0x2baf('0x30')],_0x3bf459[_0x2baf('0x31')]));if(_0x550dfb[_0x2baf('0x30')][_0x2baf('0x3f')]){_0xca894[_0x2baf('0x3b')]=_['merge'](_0xca894[_0x2baf('0x3b')],{'$or':_['map'](_0xca894[_0x2baf('0x34')],function(_0x53055c){var _0x26db58={};_0x26db58[_0x53055c]={'$like':'%'+_0x550dfb[_0x2baf('0x30')]['filter']+'%'};return _0x26db58;})});}_0xca894=_[_0x2baf('0x3d')]({},_0xca894,_0x550dfb[_0x2baf('0x40')]);return _0x347d73[_0x2baf('0x4d')](_0xca894);}})[_0x2baf('0x25')](function(_0x209bf5){if(_0x209bf5){_0x470bcf=_0x209bf5[_0x2baf('0x36')];if(!_0x550dfb[_0x2baf('0x30')][_0x2baf('0x37')](_0x2baf('0x38'))){_0xca894[_0x2baf('0x20')]=qs[_0x2baf('0x20')](_0x550dfb['query'][_0x2baf('0x20')]);_0xca894['offset']=qs[_0x2baf('0x1e')](_0x550dfb[_0x2baf('0x30')][_0x2baf('0x1e')]);}return _0x347d73[_0x2baf('0x4d')](_0xca894);}})['then'](function(_0x66283f){if(_0x66283f){return _0x66283f?{'count':_0x470bcf,'rows':_0x66283f}:null;}})[_0x2baf('0x25')](respondWithResult(_0x27e3d8,null))['catch'](handleError(_0x27e3d8,null));};exports['addConfiguration']=function(_0x9d7a5e,_0x4785c,_0x2d0122){if(_0x9d7a5e['body']['id']){delete _0x9d7a5e['body']['id'];}return db[_0x2baf('0x2d')][_0x2baf('0x4e')]({'where':{'id':_0x9d7a5e[_0x2baf('0x47')]['id']}})['then'](handleEntityNotFound(_0x4785c,null))[_0x2baf('0x25')](function(_0x10361f){if(_0x10361f){_0x9d7a5e[_0x2baf('0x4c')]['AccountId']=_0x10361f['id'];_0x9d7a5e[_0x2baf('0x4c')][_0x2baf('0x50')]=integrations['getSubjects'](_0x9d7a5e[_0x2baf('0x4c')][_0x2baf('0x51')],_0x9d7a5e[_0x2baf('0x4c')][_0x2baf('0x2f')]);_0x9d7a5e[_0x2baf('0x4c')][_0x2baf('0x52')]=integrations[_0x2baf('0x53')](_0x9d7a5e[_0x2baf('0x4c')]['channel'],_0x9d7a5e[_0x2baf('0x4c')][_0x2baf('0x2f')]);return db[_0x2baf('0x4f')][_0x2baf('0x4b')](_0x9d7a5e[_0x2baf('0x4c')],{'include':[{'model':db['ServicenowField'],'as':_0x2baf('0x50')},{'model':db[_0x2baf('0x54')],'as':_0x2baf('0x52')}]});}return null;})[_0x2baf('0x25')](respondWithResult(_0x4785c,null))[_0x2baf('0x45')](handleError(_0x4785c,null));};exports['getFields']=function(_0x489d8f,_0x11fc41,_0x179ff2){var _0x2c4cfa=[_0x2baf('0x55'),_0x2baf('0x56'),'knowledge',_0x2baf('0x57'),_0x2baf('0x58'),_0x2baf('0x59'),_0x2baf('0x5a'),_0x2baf('0x5b'),_0x2baf('0x5c')];var _0x2e8052=['parent',_0x2baf('0x55'),_0x2baf('0x5d'),_0x2baf('0x5e'),'upon_reject',_0x2baf('0x5f'),'child_incidents','hold_reason',_0x2baf('0x60'),'number','resolved_by',_0x2baf('0x61'),'opened_by',_0x2baf('0x62'),_0x2baf('0x63'),'sys_domain',_0x2baf('0x64'),'sys_created_by','knowledge',_0x2baf('0x39'),_0x2baf('0x65'),_0x2baf('0x66'),'cmdb_ci',_0x2baf('0x67'),_0x2baf('0x68'),'active','work_notes_list','business_service',_0x2baf('0x69'),_0x2baf('0x6a'),_0x2baf('0x6b'),_0x2baf('0x6c'),_0x2baf('0x6d'),_0x2baf('0x6e'),_0x2baf('0x6f'),_0x2baf('0x70'),_0x2baf('0x71'),'reopened_time',_0x2baf('0x72'),_0x2baf('0x73'),_0x2baf('0x74'),_0x2baf('0x57'),'work_notes','short_description',_0x2baf('0x58'),'correlation_display',_0x2baf('0x75'),'work_start',_0x2baf('0x76'),_0x2baf('0x77'),_0x2baf('0x78'),_0x2baf('0x79'),'calendar_duration','notify',_0x2baf('0x7a'),_0x2baf('0x7b'),'closed_by',_0x2baf('0x7c'),_0x2baf('0x7d'),_0x2baf('0x7e'),_0x2baf('0x7f'),_0x2baf('0x80'),_0x2baf('0x5a'),_0x2baf('0x81'),_0x2baf('0x82'),_0x2baf('0x83'),_0x2baf('0x84'),_0x2baf('0x85'),_0x2baf('0x86'),_0x2baf('0x5b'),'comments',_0x2baf('0x87'),_0x2baf('0x88'),_0x2baf('0x89'),_0x2baf('0x8a'),'sys_mod_count',_0x2baf('0x8b'),_0x2baf('0x8c'),'escalation','upon_approval',_0x2baf('0x8d'),_0x2baf('0x8e'),_0x2baf('0x5c')];var _0x26f059='';var _0x1bc959='';var _0x5ea7c4=[];var _0x7e95='';var _0x4c2037='';var _0x3636f1=[];var _0x491b45='';var _0x425ab1='';var _0x1156ea={};var _0x34404f='';return db[_0x2baf('0x2d')][_0x2baf('0x4e')]({'where':{'id':_0x489d8f[_0x2baf('0x47')]['id']},'attributes':['id',_0x2baf('0x8f'),'password',_0x2baf('0x90'),_0x2baf('0x91'),'serverUrl']})[_0x2baf('0x25')](handleEntityNotFound(_0x11fc41,null))['then'](function(_0x317ba7){if(_0x317ba7){_0x34404f=_0x317ba7['remoteUri'];var _0x41a504=_0x34404f[_0x2baf('0x92')](-0x1);if(_0x41a504==='/'){_0x34404f=_0x34404f['substring'](0x0,_0x34404f[_0x2baf('0x93')](_0x41a504));}_0x425ab1=util[_0x2baf('0x94')](_0x2baf('0x95'),_0x34404f);_0x491b45=util[_0x2baf('0x94')](_0x2baf('0x96'),_0x34404f);_0x1156ea={'user':_0x317ba7[_0x2baf('0x8f')],'pass':_0x317ba7[_0x2baf('0x97')]};var _0x44cab4={'method':_0x2baf('0x98'),'uri':_0x425ab1+'incident?sysparm_display_value=all','auth':_0x1156ea,'json':!![]};return rp(_0x44cab4);}})[_0x2baf('0x25')](function(_0xd44779){if(_0xd44779[_0x2baf('0x99')][_0x2baf('0x36')]>0x0){_0x26f059=_0xd44779[_0x2baf('0x99')];}console['log'](_0x2baf('0x9a'),_0x26f059);_0x3636f1=[];_0x1bc959=Object[_0x2baf('0x9b')]([],_0x26f059);_[_0x2baf('0x9c')](_0x1bc959,function(_0x23516b){return!_0x2c4cfa[_0x2baf('0x9d')](_0x23516b[_0x2baf('0x29')]);});_0x1bc959[_0x2baf('0x9e')](function(_0x29df8b){var _0x13cef0=createFieldObject(_0x491b45,_0x1156ea,_0x29df8b[_0x2baf('0x9f')],_0x29df8b[_0x2baf('0x29')],_0x29df8b[_0x2baf('0xa0')],![]);_0x3636f1[_0x2baf('0xa1')](_0x13cef0);});return Promise[_0x2baf('0xa2')](_0x3636f1);})[_0x2baf('0x25')](function(_0x2b4527){_0x5ea7c4=_0x2b4527;_0x7e95=Object[_0x2baf('0x9b')]([],_0x26f059);console[_0x2baf('0xa3')]('TCL:\x20_object',_0x26f059);_['remove'](_0x7e95,function(_0x576362){return _0x2e8052[_0x2baf('0x9d')](_0x576362['name']);});console['log'](_0x2baf('0xa4'),_0x7e95);_0x3636f1=[];_0x7e95['forEach'](function(_0x1ee452){var _0x22002d=createFieldObject(_0x491b45,_0x1156ea,_0x1ee452[_0x2baf('0x9f')],_0x1ee452[_0x2baf('0x29')],_0x1ee452[_0x2baf('0xa0')],!![]);_0x3636f1[_0x2baf('0xa1')](_0x22002d);});return Promise[_0x2baf('0xa2')](_0x3636f1);})[_0x2baf('0x25')](function(_0x49a399){_0x4c2037=_0x49a399;var _0x1dae67=_0x5ea7c4[_0x2baf('0xa5')](_0x4c2037);return{'count':_0x1dae67[_0x2baf('0x36')],'rows':_0x1dae67};})[_0x2baf('0x25')](respondWithResult(_0x11fc41,null))[_0x2baf('0x45')](function(_0x4f0e74){console['log'](_0x2baf('0xa6')+_0x4f0e74);var _0x2962c7=_0x489d8f[_0x2baf('0x30')]['test']?0x1f4:_0x4f0e74[_0x2baf('0xa7')]||0x1f4;logger['error'](_0x4f0e74['stack']);delete _0x4f0e74['name'];if(_0x2962c7===0x191){_0x2962c7=0x190;}_0x11fc41[_0x2baf('0x1c')](_0x2962c7)[_0x2baf('0x2a')](_0x489d8f[_0x2baf('0x30')][_0x2baf('0xa8')]?{'message':_0x2baf('0xa9'),'statusCode':_0x4f0e74['statusCode']}:_0x4f0e74);});};function createFieldObject(_0x3ed8fe,_0x4164aa,_0x349002,_0xc6c963,_0x3639b8,_0x23ef1d){return new Promise(function(_0x557ef0,_0x450e4e){var _0x3cb6b2={'id':_0xc6c963,'name':_0x3639b8,'custom':_0x23ef1d};if(_0x349002===_0x2baf('0xaa')){_0x3cb6b2[_0x2baf('0x40')]=[{'name':'True','value':_0x2baf('0xab')},{'name':_0x2baf('0xac'),'value':_0x2baf('0xad')}];_0x557ef0(_0x3cb6b2);}else{var _0x3cbdee={'method':'GET','uri':_0x3ed8fe+_0x2baf('0xae')+_0xc6c963,'auth':_0x4164aa,'json':!![]};return rp(_0x3cbdee)[_0x2baf('0x25')](function(_0x1bae6f){var _0x1203cb=[];if(_0x1bae6f[_0x2baf('0x99')][_0x2baf('0x36')]>0x0){_0x1bae6f[_0x2baf('0x99')][_0x2baf('0x9e')](function(_0x230c13){if(_0x230c13[_0x2baf('0xaf')]==='false'){var _0x3b4e40={'name':_0x230c13[_0x2baf('0xa0')],'value':_0x230c13[_0x2baf('0xb0')]};_0x1203cb[_0x2baf('0xa1')](_0x3b4e40);}});}_0x3cb6b2[_0x2baf('0x40')]=_0x1203cb;if(_0x3cb6b2[_0x2baf('0x40')][_0x2baf('0x36')]>0x0){_0x557ef0(_0x3cb6b2);}else{if(_0x23ef1d==![]){_0x557ef0();}else{_0x557ef0(_0x3cb6b2);}}});}});}
\ No newline at end of file
+var _0xf8c7=['problem_id','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','escalation','location','username','remoteUri','slice','substring','format','%s/api/now/doc/table/schema/','password','result','log','assign','remove','includes','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','internalType','concat','ServiceNow\x20error:\x20','test','statusCode','error','Wrong\x20credentials','boolean','True','true','False','false','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','end','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','include','create','body','update','find','params','destroy','findOne','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','getDescriptions','ServicenowConfiguration','Descriptions','getFields','hold_reason','knowledge','close_code','notify','incident_state','severity','category','parent','made_sla','watch_list','upon_reject','sys_updated_on','approval_history','number','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','priority','sys_domain_path','rfc','time_worked','expected_start','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','sys_id','reopened_by','urgency'];(function(_0x2ef16e,_0x5b1018){var _0x5787b9=function(_0xdfe85e){while(--_0xdfe85e){_0x2ef16e['push'](_0x2ef16e['shift']());}};_0x5787b9(++_0x5b1018);}(_0xf8c7,0x19e));var _0x7f8c=function(_0x3256ca,_0x49677d){_0x3256ca=_0x3256ca-0x0;var _0x323732=_0xf8c7[_0x3256ca];return _0x323732;};'use strict';var emlformat=require(_0x7f8c('0x0'));var rimraf=require(_0x7f8c('0x1'));var zipdir=require(_0x7f8c('0x2'));var jsonpatch=require(_0x7f8c('0x3'));var rp=require(_0x7f8c('0x4'));var moment=require(_0x7f8c('0x5'));var BPromise=require(_0x7f8c('0x6'));var Mustache=require(_0x7f8c('0x7'));var util=require(_0x7f8c('0x8'));var path=require(_0x7f8c('0x9'));var sox=require('sox');var csv=require(_0x7f8c('0xa'));var ejs=require(_0x7f8c('0xb'));var fs=require('fs');var fs_extra=require(_0x7f8c('0xc'));var _=require('lodash');var squel=require(_0x7f8c('0xd'));var crypto=require(_0x7f8c('0xe'));var jsforce=require(_0x7f8c('0xf'));var deskjs=require(_0x7f8c('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7f8c('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7f8c('0x12'));var qs=require(_0x7f8c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f8c('0x14'))(_0x7f8c('0x15'));var utils=require(_0x7f8c('0x16'));var config=require(_0x7f8c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7f8c('0x18'))['db'];var integrations=require(_0x7f8c('0x19'));function respondWithStatusCode(_0x152400,_0x2d5545){_0x2d5545=_0x2d5545||0xcc;return function(_0x3acf3c){if(_0x3acf3c){return _0x152400[_0x7f8c('0x1a')](_0x2d5545);}return _0x152400['status'](_0x2d5545)['end']();};}function respondWithResult(_0x46d976,_0x51995c){_0x51995c=_0x51995c||0xc8;return function(_0x44306a){if(_0x44306a){return _0x46d976[_0x7f8c('0x1b')](_0x51995c)[_0x7f8c('0x1c')](_0x44306a);}};}function respondWithFilteredResult(_0x1c1fff,_0x391b32){return function(_0x5350d1){if(_0x5350d1){var _0x544d88=typeof _0x391b32[_0x7f8c('0x1d')]==='undefined'&&typeof _0x391b32[_0x7f8c('0x1e')]===_0x7f8c('0x1f');var _0x2d4e50=_0x5350d1[_0x7f8c('0x20')];var _0xa33e78=_0x544d88?0x0:_0x391b32[_0x7f8c('0x1d')];var _0x3b7150=_0x544d88?_0x5350d1[_0x7f8c('0x20')]:_0x391b32['offset']+_0x391b32[_0x7f8c('0x1e')];var _0x5c0f11;if(_0x3b7150>=_0x2d4e50){_0x3b7150=_0x2d4e50;_0x5c0f11=0xc8;}else{_0x5c0f11=0xce;}_0x1c1fff['status'](_0x5c0f11);return _0x1c1fff[_0x7f8c('0x21')](_0x7f8c('0x22'),_0xa33e78+'-'+_0x3b7150+'/'+_0x2d4e50)[_0x7f8c('0x1c')](_0x5350d1);}return null;};}function patchUpdates(_0x18ac75){return function(_0x466a03){try{jsonpatch[_0x7f8c('0x23')](_0x466a03,_0x18ac75,!![]);}catch(_0x5aabef){return BPromise[_0x7f8c('0x24')](_0x5aabef);}return _0x466a03[_0x7f8c('0x25')]();};}function saveUpdates(_0x46baae,_0x3402ba){return function(_0x3717b2){if(_0x3717b2){return _0x3717b2['update'](_0x46baae)[_0x7f8c('0x26')](function(_0x5344e9){return _0x5344e9;});}return null;};}function removeEntity(_0x2e3514,_0x31d4a3){return function(_0x2eee59){if(_0x2eee59){return _0x2eee59['destroy']()[_0x7f8c('0x26')](function(){_0x2e3514[_0x7f8c('0x1b')](0xcc)[_0x7f8c('0x27')]();});}};}function handleEntityNotFound(_0x2e365e,_0x47b0c4){return function(_0x512418){if(!_0x512418){_0x2e365e[_0x7f8c('0x1a')](0x194);}return _0x512418;};}function handleError(_0x53bd4f,_0x243ed8){_0x243ed8=_0x243ed8||0x1f4;return function(_0x4ff59f){logger['error'](_0x4ff59f[_0x7f8c('0x28')]);if(_0x4ff59f[_0x7f8c('0x29')]){delete _0x4ff59f[_0x7f8c('0x29')];}_0x53bd4f[_0x7f8c('0x1b')](_0x243ed8)[_0x7f8c('0x2a')](_0x4ff59f);};}exports[_0x7f8c('0x2b')]=function(_0x3c5db9,_0x584918){var _0xb528d={},_0x200746={},_0x5010d1={'count':0x0,'rows':[]};var _0x588ce1=_[_0x7f8c('0x2c')](db[_0x7f8c('0x2d')][_0x7f8c('0x2e')],function(_0x38797a){return{'name':_0x38797a[_0x7f8c('0x2f')],'type':_0x38797a[_0x7f8c('0x30')][_0x7f8c('0x31')]};});_0x200746[_0x7f8c('0x32')]=_[_0x7f8c('0x2c')](_0x588ce1,_0x7f8c('0x29'));_0x200746['query']=_[_0x7f8c('0x33')](_0x3c5db9[_0x7f8c('0x34')]);_0x200746[_0x7f8c('0x35')]=_[_0x7f8c('0x36')](_0x200746[_0x7f8c('0x32')],_0x200746[_0x7f8c('0x34')]);_0xb528d['attributes']=_[_0x7f8c('0x36')](_0x200746[_0x7f8c('0x32')],qs['fields'](_0x3c5db9[_0x7f8c('0x34')][_0x7f8c('0x37')]));_0xb528d[_0x7f8c('0x38')]=_0xb528d['attributes'][_0x7f8c('0x39')]?_0xb528d[_0x7f8c('0x38')]:_0x200746[_0x7f8c('0x32')];if(!_0x3c5db9[_0x7f8c('0x34')]['hasOwnProperty'](_0x7f8c('0x3a'))){_0xb528d['limit']=qs[_0x7f8c('0x1e')](_0x3c5db9[_0x7f8c('0x34')][_0x7f8c('0x1e')]);_0xb528d[_0x7f8c('0x1d')]=qs['offset'](_0x3c5db9[_0x7f8c('0x34')][_0x7f8c('0x1d')]);}_0xb528d[_0x7f8c('0x3b')]=qs[_0x7f8c('0x3c')](_0x3c5db9[_0x7f8c('0x34')][_0x7f8c('0x3c')]);_0xb528d[_0x7f8c('0x3d')]=qs['filters'](_[_0x7f8c('0x3e')](_0x3c5db9['query'],_0x200746[_0x7f8c('0x35')]),_0x588ce1);if(_0x3c5db9['query'][_0x7f8c('0x3f')]){_0xb528d[_0x7f8c('0x3d')]=_['merge'](_0xb528d[_0x7f8c('0x3d')],{'$or':_[_0x7f8c('0x2c')](_0x588ce1,function(_0x169bc5){if(_0x169bc5['type']!==_0x7f8c('0x40')){var _0x350e1a={};_0x350e1a[_0x169bc5[_0x7f8c('0x29')]]={'$like':'%'+_0x3c5db9[_0x7f8c('0x34')][_0x7f8c('0x3f')]+'%'};return _0x350e1a;}})});}_0xb528d=_[_0x7f8c('0x41')]({},_0xb528d,_0x3c5db9[_0x7f8c('0x42')]);var _0x31df41={'where':_0xb528d[_0x7f8c('0x3d')]};return db[_0x7f8c('0x2d')][_0x7f8c('0x20')](_0x31df41)[_0x7f8c('0x26')](function(_0x28c66){_0x5010d1[_0x7f8c('0x20')]=_0x28c66;if(_0x3c5db9[_0x7f8c('0x34')][_0x7f8c('0x43')]){_0xb528d['include']=[{'all':!![]}];}return db[_0x7f8c('0x2d')][_0x7f8c('0x44')](_0xb528d);})['then'](function(_0xf1159a){_0x5010d1[_0x7f8c('0x45')]=_0xf1159a;return _0x5010d1;})[_0x7f8c('0x26')](respondWithFilteredResult(_0x584918,_0xb528d))[_0x7f8c('0x46')](handleError(_0x584918,null));};exports[_0x7f8c('0x47')]=function(_0x48791d,_0x2427d8){var _0x43490d={'raw':![],'where':{'id':_0x48791d['params']['id']}},_0xfabc3f={};_0xfabc3f[_0x7f8c('0x32')]=_[_0x7f8c('0x33')](db[_0x7f8c('0x2d')]['rawAttributes']);_0xfabc3f['query']=_[_0x7f8c('0x33')](_0x48791d[_0x7f8c('0x34')]);_0xfabc3f['filters']=_[_0x7f8c('0x36')](_0xfabc3f[_0x7f8c('0x32')],_0xfabc3f['query']);_0x43490d['attributes']=_[_0x7f8c('0x36')](_0xfabc3f[_0x7f8c('0x32')],qs[_0x7f8c('0x37')](_0x48791d[_0x7f8c('0x34')]['fields']));_0x43490d['attributes']=_0x43490d['attributes'][_0x7f8c('0x39')]?_0x43490d[_0x7f8c('0x38')]:_0xfabc3f['model'];if(_0x48791d[_0x7f8c('0x34')][_0x7f8c('0x43')]){_0x43490d[_0x7f8c('0x48')]=[{'all':!![]}];}_0x43490d=_['merge']({},_0x43490d,_0x48791d['options']);return db[_0x7f8c('0x2d')]['find'](_0x43490d)[_0x7f8c('0x26')](handleEntityNotFound(_0x2427d8,null))[_0x7f8c('0x26')](respondWithResult(_0x2427d8,null))[_0x7f8c('0x46')](handleError(_0x2427d8,null));};exports[_0x7f8c('0x49')]=function(_0x1985ae,_0x3bd80f){return db[_0x7f8c('0x2d')][_0x7f8c('0x49')](_0x1985ae[_0x7f8c('0x4a')],{})['then'](respondWithResult(_0x3bd80f,0xc9))[_0x7f8c('0x46')](handleError(_0x3bd80f,null));};exports[_0x7f8c('0x4b')]=function(_0x1ea94a,_0x548923){if(_0x1ea94a[_0x7f8c('0x4a')]['id']){delete _0x1ea94a[_0x7f8c('0x4a')]['id'];}return db[_0x7f8c('0x2d')][_0x7f8c('0x4c')]({'where':{'id':_0x1ea94a[_0x7f8c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x548923,null))[_0x7f8c('0x26')](saveUpdates(_0x1ea94a[_0x7f8c('0x4a')],null))[_0x7f8c('0x26')](respondWithResult(_0x548923,null))[_0x7f8c('0x46')](handleError(_0x548923,null));};exports[_0x7f8c('0x4e')]=function(_0x2367d8,_0x3332ea){return db[_0x7f8c('0x2d')]['find']({'where':{'id':_0x2367d8[_0x7f8c('0x4d')]['id']}})[_0x7f8c('0x26')](handleEntityNotFound(_0x3332ea,null))[_0x7f8c('0x26')](removeEntity(_0x3332ea,null))[_0x7f8c('0x46')](handleError(_0x3332ea,null));};exports['getConfigurations']=function(_0x2b3dfa,_0x519768,_0x309b28){var _0x9d9a53={};var _0x542b7f={};var _0x3884d2;var _0x8c3a79;return db[_0x7f8c('0x2d')][_0x7f8c('0x4f')]({'where':{'id':_0x2b3dfa[_0x7f8c('0x4d')]['id']}})[_0x7f8c('0x26')](handleEntityNotFound(_0x519768,null))[_0x7f8c('0x26')](function(_0x142d1c){if(_0x142d1c){_0x3884d2=_0x142d1c;_0x542b7f[_0x7f8c('0x32')]=_[_0x7f8c('0x33')](db['ServicenowConfiguration'][_0x7f8c('0x2e')]);_0x542b7f['query']=_[_0x7f8c('0x33')](_0x2b3dfa[_0x7f8c('0x34')]);_0x542b7f[_0x7f8c('0x35')]=_['intersection'](_0x542b7f[_0x7f8c('0x32')],_0x542b7f[_0x7f8c('0x34')]);_0x9d9a53[_0x7f8c('0x38')]=_[_0x7f8c('0x36')](_0x542b7f['model'],qs[_0x7f8c('0x37')](_0x2b3dfa['query']['fields']));_0x9d9a53[_0x7f8c('0x38')]=_0x9d9a53[_0x7f8c('0x38')][_0x7f8c('0x39')]?_0x9d9a53[_0x7f8c('0x38')]:_0x542b7f[_0x7f8c('0x32')];_0x9d9a53[_0x7f8c('0x3b')]=qs['sort'](_0x2b3dfa['query'][_0x7f8c('0x3c')]);_0x9d9a53['where']=qs[_0x7f8c('0x35')](_[_0x7f8c('0x3e')](_0x2b3dfa['query'],_0x542b7f[_0x7f8c('0x35')]));if(_0x2b3dfa[_0x7f8c('0x34')]['filter']){_0x9d9a53[_0x7f8c('0x3d')]=_[_0x7f8c('0x41')](_0x9d9a53[_0x7f8c('0x3d')],{'$or':_[_0x7f8c('0x2c')](_0x9d9a53['attributes'],function(_0x44cdeb){var _0x1cb63d={};_0x1cb63d[_0x44cdeb]={'$like':'%'+_0x2b3dfa[_0x7f8c('0x34')][_0x7f8c('0x3f')]+'%'};return _0x1cb63d;})});}_0x9d9a53=_[_0x7f8c('0x41')]({},_0x9d9a53,_0x2b3dfa['options']);return _0x3884d2[_0x7f8c('0x50')](_0x9d9a53);}})['then'](function(_0x21bdd1){if(_0x21bdd1){_0x8c3a79=_0x21bdd1['length'];if(!_0x2b3dfa[_0x7f8c('0x34')][_0x7f8c('0x51')](_0x7f8c('0x3a'))){_0x9d9a53[_0x7f8c('0x1e')]=qs[_0x7f8c('0x1e')](_0x2b3dfa['query'][_0x7f8c('0x1e')]);_0x9d9a53[_0x7f8c('0x1d')]=qs[_0x7f8c('0x1d')](_0x2b3dfa[_0x7f8c('0x34')]['offset']);}return _0x3884d2[_0x7f8c('0x50')](_0x9d9a53);}})['then'](function(_0x4be3b6){if(_0x4be3b6){return _0x4be3b6?{'count':_0x8c3a79,'rows':_0x4be3b6}:null;}})[_0x7f8c('0x26')](respondWithResult(_0x519768,null))[_0x7f8c('0x46')](handleError(_0x519768,null));};exports[_0x7f8c('0x52')]=function(_0x16d700,_0x34f249,_0x551c47){if(_0x16d700[_0x7f8c('0x4a')]['id']){delete _0x16d700[_0x7f8c('0x4a')]['id'];}return db[_0x7f8c('0x2d')][_0x7f8c('0x4f')]({'where':{'id':_0x16d700[_0x7f8c('0x4d')]['id']}})[_0x7f8c('0x26')](handleEntityNotFound(_0x34f249,null))['then'](function(_0x4c0961){if(_0x4c0961){_0x16d700[_0x7f8c('0x4a')][_0x7f8c('0x53')]=_0x4c0961['id'];_0x16d700[_0x7f8c('0x4a')][_0x7f8c('0x54')]=integrations['getSubjects'](_0x16d700[_0x7f8c('0x4a')][_0x7f8c('0x55')],_0x16d700[_0x7f8c('0x4a')][_0x7f8c('0x30')]);_0x16d700[_0x7f8c('0x4a')]['Descriptions']=integrations[_0x7f8c('0x56')](_0x16d700['body'][_0x7f8c('0x55')],_0x16d700[_0x7f8c('0x4a')][_0x7f8c('0x30')]);return db[_0x7f8c('0x57')]['create'](_0x16d700[_0x7f8c('0x4a')],{'include':[{'model':db['ServicenowField'],'as':_0x7f8c('0x54')},{'model':db['ServicenowField'],'as':_0x7f8c('0x58')}]});}return null;})['then'](respondWithResult(_0x34f249,null))['catch'](handleError(_0x34f249,null));};exports[_0x7f8c('0x59')]=function(_0x26a0e5,_0x8059c1,_0xf9535){var _0x556b16=['made_sla',_0x7f8c('0x5a'),_0x7f8c('0x5b'),'subcategory',_0x7f8c('0x5c'),_0x7f8c('0x5d'),_0x7f8c('0x5e'),_0x7f8c('0x5f'),_0x7f8c('0x60')];var _0x103d63=[_0x7f8c('0x61'),_0x7f8c('0x62'),'caused_by',_0x7f8c('0x63'),_0x7f8c('0x64'),_0x7f8c('0x65'),'child_incidents',_0x7f8c('0x5a'),_0x7f8c('0x66'),_0x7f8c('0x67'),'resolved_by',_0x7f8c('0x68'),'opened_by',_0x7f8c('0x69'),_0x7f8c('0x6a'),_0x7f8c('0x6b'),_0x7f8c('0x6c'),_0x7f8c('0x6d'),_0x7f8c('0x5b'),'order','calendar_stc',_0x7f8c('0x6e'),_0x7f8c('0x6f'),_0x7f8c('0x70'),'impact',_0x7f8c('0x71'),_0x7f8c('0x72'),'business_service',_0x7f8c('0x73'),_0x7f8c('0x74'),_0x7f8c('0x75'),_0x7f8c('0x76'),_0x7f8c('0x77'),'opened_at','business_duration',_0x7f8c('0x78'),_0x7f8c('0x79'),_0x7f8c('0x7a'),_0x7f8c('0x7b'),_0x7f8c('0x7c'),_0x7f8c('0x7d'),'subcategory',_0x7f8c('0x7e'),_0x7f8c('0x7f'),_0x7f8c('0x5c'),_0x7f8c('0x80'),'delivery_task',_0x7f8c('0x81'),_0x7f8c('0x82'),_0x7f8c('0x83'),_0x7f8c('0x84'),'description',_0x7f8c('0x85'),_0x7f8c('0x5d'),_0x7f8c('0x86'),_0x7f8c('0x87'),_0x7f8c('0x88'),_0x7f8c('0x89'),'parent_incident',_0x7f8c('0x8a'),'contact_type',_0x7f8c('0x8b'),_0x7f8c('0x5e'),_0x7f8c('0x8c'),_0x7f8c('0x8d'),'company',_0x7f8c('0x8e'),_0x7f8c('0x8f'),'assigned_to',_0x7f8c('0x5f'),_0x7f8c('0x90'),_0x7f8c('0x91'),_0x7f8c('0x92'),_0x7f8c('0x93'),_0x7f8c('0x94'),_0x7f8c('0x95'),'reopen_count',_0x7f8c('0x96'),_0x7f8c('0x97'),'upon_approval','correlation_id',_0x7f8c('0x98'),_0x7f8c('0x60')];var _0x58afb8='';var _0x584ac8='';var _0x1b9b34=[];var _0x18a278='';var _0x3644c0='';var _0x2f52c1=[];var _0x1000f6='';var _0x4e4402='';var _0x26f3e6={};var _0x4d8b63='';return db[_0x7f8c('0x2d')][_0x7f8c('0x4f')]({'where':{'id':_0x26a0e5['params']['id']},'attributes':['id',_0x7f8c('0x99'),'password','email',_0x7f8c('0x9a'),'serverUrl']})[_0x7f8c('0x26')](handleEntityNotFound(_0x8059c1,null))['then'](function(_0x15b36a){if(_0x15b36a){_0x4d8b63=_0x15b36a[_0x7f8c('0x9a')];var _0x3d1935=_0x4d8b63[_0x7f8c('0x9b')](-0x1);if(_0x3d1935==='/'){_0x4d8b63=_0x4d8b63[_0x7f8c('0x9c')](0x0,_0x4d8b63['lastIndexOf'](_0x3d1935));}_0x4e4402=util[_0x7f8c('0x9d')](_0x7f8c('0x9e'),_0x4d8b63);_0x1000f6=util[_0x7f8c('0x9d')]('%s/api/now/table/',_0x4d8b63);_0x26f3e6={'user':_0x15b36a[_0x7f8c('0x99')],'pass':_0x15b36a[_0x7f8c('0x9f')]};var _0x37d3a0={'method':'GET','uri':_0x4e4402+'incident?sysparm_display_value=all','auth':_0x26f3e6,'json':!![]};return rp(_0x37d3a0);}})['then'](function(_0x41d9ec){if(_0x41d9ec['result'][_0x7f8c('0x39')]>0x0){_0x58afb8=_0x41d9ec[_0x7f8c('0xa0')];}console[_0x7f8c('0xa1')]('incident\x20table\x20objects',_0x58afb8);_0x2f52c1=[];_0x584ac8=Object[_0x7f8c('0xa2')]([],_0x58afb8);_[_0x7f8c('0xa3')](_0x584ac8,function(_0x3e2c6d){return!_0x556b16[_0x7f8c('0xa4')](_0x3e2c6d[_0x7f8c('0x29')]);});_0x584ac8['forEach'](function(_0x2af368){var _0x3ef84b=createFieldObject(_0x1000f6,_0x26f3e6,_0x2af368['internalType'],_0x2af368[_0x7f8c('0x29')],_0x2af368[_0x7f8c('0xa5')],![]);_0x2f52c1[_0x7f8c('0xa6')](_0x3ef84b);});return Promise[_0x7f8c('0xa7')](_0x2f52c1);})[_0x7f8c('0x26')](function(_0x284ea2){_0x1b9b34=_0x284ea2;_0x18a278=Object[_0x7f8c('0xa2')]([],_0x58afb8);console[_0x7f8c('0xa1')](_0x7f8c('0xa8'),_0x58afb8);_['remove'](_0x18a278,function(_0x25f15f){return _0x103d63[_0x7f8c('0xa4')](_0x25f15f[_0x7f8c('0x29')]);});console[_0x7f8c('0xa1')](_0x7f8c('0xa9'),_0x18a278);_0x2f52c1=[];_0x18a278[_0x7f8c('0xaa')](function(_0x274243){var _0x15a98e=createFieldObject(_0x1000f6,_0x26f3e6,_0x274243[_0x7f8c('0xab')],_0x274243[_0x7f8c('0x29')],_0x274243[_0x7f8c('0xa5')],!![]);_0x2f52c1[_0x7f8c('0xa6')](_0x15a98e);});return Promise[_0x7f8c('0xa7')](_0x2f52c1);})[_0x7f8c('0x26')](function(_0x51e0d4){_0x3644c0=_0x51e0d4;var _0x596553=_0x1b9b34[_0x7f8c('0xac')](_0x3644c0);return{'count':_0x596553['length'],'rows':_0x596553};})[_0x7f8c('0x26')](respondWithResult(_0x8059c1,null))['catch'](function(_0x189689){console['log'](_0x7f8c('0xad')+_0x189689);var _0x442ea0=_0x26a0e5['query'][_0x7f8c('0xae')]?0x1f4:_0x189689[_0x7f8c('0xaf')]||0x1f4;logger[_0x7f8c('0xb0')](_0x189689[_0x7f8c('0x28')]);delete _0x189689[_0x7f8c('0x29')];if(_0x442ea0===0x191){_0x442ea0=0x190;}_0x8059c1[_0x7f8c('0x1b')](_0x442ea0)['send'](_0x26a0e5[_0x7f8c('0x34')][_0x7f8c('0xae')]?{'message':_0x7f8c('0xb1'),'statusCode':_0x189689[_0x7f8c('0xaf')]}:_0x189689);});};function createFieldObject(_0x2ebc28,_0xb95faf,_0x42e645,_0x1b4245,_0x251ee6,_0x204853){return new Promise(function(_0x21f90c,_0x42e0db){var _0x2a2568={'id':_0x1b4245,'name':_0x251ee6,'custom':_0x204853};if(_0x42e645===_0x7f8c('0xb2')){_0x2a2568[_0x7f8c('0x42')]=[{'name':_0x7f8c('0xb3'),'value':_0x7f8c('0xb4')},{'name':_0x7f8c('0xb5'),'value':_0x7f8c('0xb6')}];_0x21f90c(_0x2a2568);}else{var _0x96c888={'method':'GET','uri':_0x2ebc28+'sys_choice?sysparm_query=name=incident^element='+_0x1b4245,'auth':_0xb95faf,'json':!![]};return rp(_0x96c888)[_0x7f8c('0x26')](function(_0x298a04){var _0x2e68ba=[];if(_0x298a04['result'][_0x7f8c('0x39')]>0x0){_0x298a04[_0x7f8c('0xa0')][_0x7f8c('0xaa')](function(_0x3acf14){if(_0x3acf14[_0x7f8c('0xb7')]===_0x7f8c('0xb6')){var _0x12dd5e={'name':_0x3acf14[_0x7f8c('0xa5')],'value':_0x3acf14[_0x7f8c('0xb8')]};_0x2e68ba[_0x7f8c('0xa6')](_0x12dd5e);}});}_0x2a2568['options']=_0x2e68ba;if(_0x2a2568[_0x7f8c('0x42')][_0x7f8c('0x39')]>0x0){_0x21f90c(_0x2a2568);}else{if(_0x204853==![]){_0x21f90c();}else{_0x21f90c(_0x2a2568);}}});}});}
\ No newline at end of file