Built motion from commit (unavailable).|2.5.23
[motion2.git] / server / api / intServicenowAccount / intServicenowAccount.controller.js
index 66d9f7a..8da1d00 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x540f=['test','statusCode','stack','Wrong\x20credentials','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','apply','reject','save','destroy','name','send','map','ServicenowAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','show','params','options','find','create','body','update','getConfigurations','findOne','ServicenowConfiguration','order','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','hold_reason','subcategory','close_code','severity','category','parent','made_sla','caused_by','watch_list','sys_updated_on','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','cmdb_ci','active','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','work_start','business_stc','additional_assignee_list','calendar_duration','notify','sys_class_name','close_notes','closed_by','parent_incident','sys_id','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','activity_due','comments','sla_due','due_date','sys_mod_count','sys_tags','escalation','upon_approval','location','username','password','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','includes','forEach','internalType','label','push','all','assign','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x540f,0xc3));var _0xf540=function(_0x3ec1da,_0x1e36f5){_0x3ec1da=_0x3ec1da-0x0;var _0x472358=_0x540f[_0x3ec1da];return _0x472358;};'use strict';var pdf=require(_0xf540('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf540('0x1'));var zipdir=require(_0xf540('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf540('0x3'));var moment=require(_0xf540('0x4'));var BPromise=require(_0xf540('0x5'));var Mustache=require(_0xf540('0x6'));var util=require(_0xf540('0x7'));var path=require(_0xf540('0x8'));var sox=require(_0xf540('0x9'));var csv=require(_0xf540('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf540('0xb'));var crypto=require('crypto');var jsforce=require(_0xf540('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf540('0xa'));var querystring=require('querystring');var Papa=require(_0xf540('0xd'));var Redis=require(_0xf540('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf540('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf540('0x10'))(_0xf540('0x11'));var utils=require(_0xf540('0x12'));var config=require(_0xf540('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xf540('0x14'));var jayson=require(_0xf540('0x15'));var client=jayson[_0xf540('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5234e4,_0x1584b0,_0x33ce74,_0x2eba2d){return new BPromise(function(_0x294970,_0x3a4510){var _0x5ae50e=_0x2eba2d||client;return _0x5ae50e['request'](_0x5234e4,_0x33ce74)[_0xf540('0x17')](function(_0x430227){logger[_0xf540('0x18')](_0xf540('0x19'),_0x1584b0,_0xf540('0x1a'));logger['debug'](_0xf540('0x1b'),_0x1584b0,'request\x20sent',JSON[_0xf540('0x1c')](_0x430227));if(_0x430227[_0xf540('0x1d')]){if(_0x430227[_0xf540('0x1d')][_0xf540('0x1e')]===0x1f4){logger[_0xf540('0x1d')](_0xf540('0x19'),_0x1584b0,_0x430227[_0xf540('0x1d')][_0xf540('0x1f')]);return _0x3a4510(_0x430227[_0xf540('0x1d')]['message']);}logger[_0xf540('0x1d')](_0xf540('0x19'),_0x1584b0,_0x430227['error'][_0xf540('0x1f')]);return _0x294970(_0x430227[_0xf540('0x1d')][_0xf540('0x1f')]);}else{logger[_0xf540('0x18')](_0xf540('0x19'),_0x1584b0,_0xf540('0x1a'));_0x294970(_0x430227[_0xf540('0x20')][_0xf540('0x1f')]);}})[_0xf540('0x21')](function(_0xf1efbb){logger[_0xf540('0x1d')](_0xf540('0x19'),_0x1584b0,_0xf1efbb);_0x3a4510(_0xf1efbb);});});}function respondWithStatusCode(_0x3d42e7,_0x1b8980){_0x1b8980=_0x1b8980||0xcc;return function(_0x1cea96){if(_0x1cea96){return _0x3d42e7[_0xf540('0x22')](_0x1b8980);}return _0x3d42e7[_0xf540('0x23')](_0x1b8980)[_0xf540('0x24')]();};}function respondWithResult(_0x469ad5,_0x3460ac){_0x3460ac=_0x3460ac||0xc8;return function(_0xf06265){if(_0xf06265){return _0x469ad5[_0xf540('0x23')](_0x3460ac)[_0xf540('0x25')](_0xf06265);}};}function respondWithFilteredResult(_0x484307,_0x110411){return function(_0x460630){if(_0x460630){var _0x3b31dd=_0x460630['count'],_0x586f7b=_0x110411[_0xf540('0x26')],_0x33e4e3=_0x110411[_0xf540('0x26')]+_0x110411[_0xf540('0x27')],_0x4115f5;if(_0x33e4e3>=_0x3b31dd){_0x33e4e3=_0x3b31dd;_0x4115f5=0xc8;}else{_0x4115f5=0xce;}_0x484307['status'](_0x4115f5);return _0x484307['set']('Content-Range',_0x586f7b+'-'+_0x33e4e3+'/'+_0x3b31dd)[_0xf540('0x25')](_0x460630);}return null;};}function patchUpdates(_0x2cfc50){return function(_0x3128f2){try{jsonpatch[_0xf540('0x28')](_0x3128f2,_0x2cfc50,!![]);}catch(_0x2c1316){return BPromise[_0xf540('0x29')](_0x2c1316);}return _0x3128f2[_0xf540('0x2a')]();};}function saveUpdates(_0x5847d8,_0x90e7d0){return function(_0x382cc1){if(_0x382cc1){return _0x382cc1['update'](_0x5847d8)['then'](function(_0x5ccd7f){return _0x5ccd7f;});}return null;};}function removeEntity(_0x1396ac,_0x1d6010){return function(_0x37ea0e){if(_0x37ea0e){return _0x37ea0e[_0xf540('0x2b')]()[_0xf540('0x17')](function(){_0x1396ac[_0xf540('0x23')](0xcc)[_0xf540('0x24')]();});}};}function handleEntityNotFound(_0x4f5782,_0x53843d){return function(_0x53e083){if(!_0x53e083){_0x4f5782[_0xf540('0x22')](0x194);}return _0x53e083;};}function handleError(_0x5c8e4b,_0x7dd276){_0x7dd276=_0x7dd276||0x1f4;return function(_0x408039){logger[_0xf540('0x1d')](_0x408039['stack']);if(_0x408039[_0xf540('0x2c')]){delete _0x408039['name'];}_0x5c8e4b[_0xf540('0x23')](_0x7dd276)[_0xf540('0x2d')](_0x408039);};}exports['index']=function(_0xc931e1,_0x584472){var _0x39474c={},_0x3a4f90={},_0x20f365={'count':0x0,'rows':[]};var _0x59eb90=_[_0xf540('0x2e')](db[_0xf540('0x2f')][_0xf540('0x30')],function(_0x367180){return{'name':_0x367180[_0xf540('0x31')],'type':_0x367180[_0xf540('0x32')]['key']};});_0x3a4f90['model']=_[_0xf540('0x2e')](_0x59eb90,_0xf540('0x2c'));_0x3a4f90[_0xf540('0x33')]=_[_0xf540('0x34')](_0xc931e1[_0xf540('0x33')]);_0x3a4f90[_0xf540('0x35')]=_[_0xf540('0x36')](_0x3a4f90[_0xf540('0x37')],_0x3a4f90[_0xf540('0x33')]);_0x39474c[_0xf540('0x38')]=_[_0xf540('0x36')](_0x3a4f90['model'],qs[_0xf540('0x39')](_0xc931e1[_0xf540('0x33')][_0xf540('0x39')]));_0x39474c['attributes']=_0x39474c[_0xf540('0x38')][_0xf540('0x3a')]?_0x39474c[_0xf540('0x38')]:_0x3a4f90[_0xf540('0x37')];if(!_0xc931e1[_0xf540('0x33')]['hasOwnProperty'](_0xf540('0x3b'))){_0x39474c[_0xf540('0x27')]=qs[_0xf540('0x27')](_0xc931e1[_0xf540('0x33')]['limit']);_0x39474c['offset']=qs[_0xf540('0x26')](_0xc931e1[_0xf540('0x33')][_0xf540('0x26')]);}_0x39474c['order']=qs['sort'](_0xc931e1['query'][_0xf540('0x3c')]);_0x39474c[_0xf540('0x3d')]=qs['filters'](_[_0xf540('0x3e')](_0xc931e1[_0xf540('0x33')],_0x3a4f90[_0xf540('0x35')]),_0x59eb90);if(_0xc931e1['query'][_0xf540('0x3f')]){_0x39474c[_0xf540('0x3d')]=_[_0xf540('0x40')](_0x39474c['where'],{'$or':_[_0xf540('0x2e')](_0x59eb90,function(_0x19c447){if(_0x19c447[_0xf540('0x32')]!=='VIRTUAL'){var _0x27bd2a={};_0x27bd2a[_0x19c447[_0xf540('0x2c')]]={'$like':'%'+_0xc931e1[_0xf540('0x33')][_0xf540('0x3f')]+'%'};return _0x27bd2a;}})});}_0x39474c=_[_0xf540('0x40')]({},_0x39474c,_0xc931e1['options']);var _0x4effe={'where':_0x39474c[_0xf540('0x3d')]};return db[_0xf540('0x2f')][_0xf540('0x41')](_0x4effe)['then'](function(_0x52b8f2){_0x20f365['count']=_0x52b8f2;if(_0xc931e1[_0xf540('0x33')][_0xf540('0x42')]){_0x39474c[_0xf540('0x43')]=[{'all':!![]}];}return db[_0xf540('0x2f')][_0xf540('0x44')](_0x39474c);})[_0xf540('0x17')](function(_0x3b5425){_0x20f365[_0xf540('0x45')]=_0x3b5425;return _0x20f365;})[_0xf540('0x17')](respondWithFilteredResult(_0x584472,_0x39474c))[_0xf540('0x21')](handleError(_0x584472,null));};exports[_0xf540('0x46')]=function(_0x485a4f,_0x123c0b){var _0x5ab0e3={'raw':![],'where':{'id':_0x485a4f[_0xf540('0x47')]['id']}},_0x3a1119={};_0x3a1119['model']=_[_0xf540('0x34')](db[_0xf540('0x2f')][_0xf540('0x30')]);_0x3a1119['query']=_[_0xf540('0x34')](_0x485a4f['query']);_0x3a1119[_0xf540('0x35')]=_[_0xf540('0x36')](_0x3a1119[_0xf540('0x37')],_0x3a1119['query']);_0x5ab0e3[_0xf540('0x38')]=_[_0xf540('0x36')](_0x3a1119[_0xf540('0x37')],qs[_0xf540('0x39')](_0x485a4f[_0xf540('0x33')]['fields']));_0x5ab0e3[_0xf540('0x38')]=_0x5ab0e3[_0xf540('0x38')][_0xf540('0x3a')]?_0x5ab0e3[_0xf540('0x38')]:_0x3a1119['model'];if(_0x485a4f[_0xf540('0x33')][_0xf540('0x42')]){_0x5ab0e3['include']=[{'all':!![]}];}_0x5ab0e3=_[_0xf540('0x40')]({},_0x5ab0e3,_0x485a4f[_0xf540('0x48')]);return db[_0xf540('0x2f')][_0xf540('0x49')](_0x5ab0e3)[_0xf540('0x17')](handleEntityNotFound(_0x123c0b,null))[_0xf540('0x17')](respondWithResult(_0x123c0b,null))[_0xf540('0x21')](handleError(_0x123c0b,null));};exports[_0xf540('0x4a')]=function(_0x3c45d7,_0x30e62b){return db[_0xf540('0x2f')][_0xf540('0x4a')](_0x3c45d7[_0xf540('0x4b')],{})[_0xf540('0x17')](respondWithResult(_0x30e62b,0xc9))[_0xf540('0x21')](handleError(_0x30e62b,null));};exports[_0xf540('0x4c')]=function(_0x42212f,_0x4b1238){if(_0x42212f[_0xf540('0x4b')]['id']){delete _0x42212f['body']['id'];}return db['ServicenowAccount'][_0xf540('0x49')]({'where':{'id':_0x42212f[_0xf540('0x47')]['id']}})[_0xf540('0x17')](handleEntityNotFound(_0x4b1238,null))['then'](saveUpdates(_0x42212f['body'],null))[_0xf540('0x17')](respondWithResult(_0x4b1238,null))[_0xf540('0x21')](handleError(_0x4b1238,null));};exports[_0xf540('0x2b')]=function(_0x39c90b,_0x5e15db){return db[_0xf540('0x2f')][_0xf540('0x49')]({'where':{'id':_0x39c90b['params']['id']}})[_0xf540('0x17')](handleEntityNotFound(_0x5e15db,null))[_0xf540('0x17')](removeEntity(_0x5e15db,null))[_0xf540('0x21')](handleError(_0x5e15db,null));};exports[_0xf540('0x4d')]=function(_0x335b0d,_0x3db657,_0x84cca7){var _0x385f9b={};var _0x35711e={};var _0x52f99d;var _0x1e479c;return db[_0xf540('0x2f')][_0xf540('0x4e')]({'where':{'id':_0x335b0d[_0xf540('0x47')]['id']}})['then'](handleEntityNotFound(_0x3db657,null))[_0xf540('0x17')](function(_0x60da19){if(_0x60da19){_0x52f99d=_0x60da19;_0x35711e[_0xf540('0x37')]=_['keys'](db[_0xf540('0x4f')][_0xf540('0x30')]);_0x35711e['query']=_[_0xf540('0x34')](_0x335b0d[_0xf540('0x33')]);_0x35711e[_0xf540('0x35')]=_['intersection'](_0x35711e[_0xf540('0x37')],_0x35711e['query']);_0x385f9b[_0xf540('0x38')]=_[_0xf540('0x36')](_0x35711e['model'],qs['fields'](_0x335b0d['query'][_0xf540('0x39')]));_0x385f9b[_0xf540('0x38')]=_0x385f9b[_0xf540('0x38')]['length']?_0x385f9b['attributes']:_0x35711e[_0xf540('0x37')];_0x385f9b[_0xf540('0x50')]=qs[_0xf540('0x3c')](_0x335b0d['query'][_0xf540('0x3c')]);_0x385f9b[_0xf540('0x3d')]=qs[_0xf540('0x35')](_[_0xf540('0x3e')](_0x335b0d['query'],_0x35711e[_0xf540('0x35')]));if(_0x335b0d[_0xf540('0x33')]['filter']){_0x385f9b['where']=_[_0xf540('0x40')](_0x385f9b[_0xf540('0x3d')],{'$or':_[_0xf540('0x2e')](_0x385f9b[_0xf540('0x38')],function(_0x1a252e){var _0x410e8a={};_0x410e8a[_0x1a252e]={'$like':'%'+_0x335b0d[_0xf540('0x33')][_0xf540('0x3f')]+'%'};return _0x410e8a;})});}_0x385f9b=_[_0xf540('0x40')]({},_0x385f9b,_0x335b0d['options']);return _0x52f99d[_0xf540('0x4d')](_0x385f9b);}})['then'](function(_0x238c0a){if(_0x238c0a){_0x1e479c=_0x238c0a['length'];if(!_0x335b0d[_0xf540('0x33')][_0xf540('0x51')](_0xf540('0x3b'))){_0x385f9b[_0xf540('0x27')]=qs['limit'](_0x335b0d[_0xf540('0x33')][_0xf540('0x27')]);_0x385f9b[_0xf540('0x26')]=qs[_0xf540('0x26')](_0x335b0d[_0xf540('0x33')][_0xf540('0x26')]);}return _0x52f99d[_0xf540('0x4d')](_0x385f9b);}})['then'](function(_0x1fc8d3){if(_0x1fc8d3){return _0x1fc8d3?{'count':_0x1e479c,'rows':_0x1fc8d3}:null;}})[_0xf540('0x17')](respondWithResult(_0x3db657,null))[_0xf540('0x21')](handleError(_0x3db657,null));};exports[_0xf540('0x52')]=function(_0x616066,_0x274550,_0x6f9034){if(_0x616066[_0xf540('0x4b')]['id']){delete _0x616066['body']['id'];}return db[_0xf540('0x2f')]['findOne']({'where':{'id':_0x616066[_0xf540('0x47')]['id']}})[_0xf540('0x17')](handleEntityNotFound(_0x274550,null))[_0xf540('0x17')](function(_0x58a6be){if(_0x58a6be){_0x616066[_0xf540('0x4b')]['AccountId']=_0x58a6be['id'];_0x616066[_0xf540('0x4b')][_0xf540('0x53')]=integrations[_0xf540('0x54')](_0x616066[_0xf540('0x4b')][_0xf540('0x55')],_0x616066[_0xf540('0x4b')][_0xf540('0x32')]);_0x616066['body']['Descriptions']=integrations[_0xf540('0x56')](_0x616066[_0xf540('0x4b')][_0xf540('0x55')],_0x616066['body'][_0xf540('0x32')]);return db[_0xf540('0x4f')]['create'](_0x616066[_0xf540('0x4b')],{'include':[{'model':db[_0xf540('0x57')],'as':_0xf540('0x53')},{'model':db[_0xf540('0x57')],'as':_0xf540('0x58')}]});}return null;})['then'](respondWithResult(_0x274550,null))[_0xf540('0x21')](handleError(_0x274550,null));};exports['getFields']=function(_0x2c84ca,_0x305e73,_0x526149){var _0x23e304=['made_sla',_0xf540('0x59'),'knowledge',_0xf540('0x5a'),_0xf540('0x5b'),'notify','incident_state',_0xf540('0x5c'),_0xf540('0x5d')];var _0x301690=[_0xf540('0x5e'),_0xf540('0x5f'),_0xf540('0x60'),_0xf540('0x61'),'upon_reject',_0xf540('0x62'),'child_incidents',_0xf540('0x59'),_0xf540('0x63'),'number',_0xf540('0x64'),_0xf540('0x65'),_0xf540('0x66'),_0xf540('0x67'),_0xf540('0x68'),_0xf540('0x69'),_0xf540('0x6a'),_0xf540('0x6b'),'knowledge',_0xf540('0x50'),_0xf540('0x6c'),'closed_at',_0xf540('0x6d'),'delivery_plan','impact',_0xf540('0x6e'),'work_notes_list','business_service',_0xf540('0x6f'),_0xf540('0x70'),_0xf540('0x71'),_0xf540('0x72'),_0xf540('0x73'),_0xf540('0x74'),_0xf540('0x75'),_0xf540('0x76'),_0xf540('0x77'),_0xf540('0x78'),_0xf540('0x79'),_0xf540('0x7a'),_0xf540('0x7b'),_0xf540('0x5a'),_0xf540('0x7c'),_0xf540('0x7d'),_0xf540('0x5b'),_0xf540('0x7e'),'delivery_task',_0xf540('0x7f'),'assignment_group',_0xf540('0x80'),_0xf540('0x81'),'description',_0xf540('0x82'),_0xf540('0x83'),_0xf540('0x84'),_0xf540('0x85'),_0xf540('0x86'),'follow_up',_0xf540('0x87'),_0xf540('0x88'),'contact_type',_0xf540('0x89'),_0xf540('0x8a'),_0xf540('0x8b'),_0xf540('0x8c'),_0xf540('0x8d'),_0xf540('0x8e'),_0xf540('0x8f'),'assigned_to',_0xf540('0x5c'),_0xf540('0x90'),_0xf540('0x91'),'approval','comments_and_work_notes',_0xf540('0x92'),_0xf540('0x93'),'reopen_count',_0xf540('0x94'),_0xf540('0x95'),_0xf540('0x96'),'correlation_id',_0xf540('0x97'),'category'];var _0x508b68='';var _0xe2e366='';var _0x291a08=[];var _0x2e4e6f='';var _0x178147='';var _0x1e67b2=[];var _0x9133b3='';var _0x5ebc76='';var _0x58bd20={};var _0xf0cb8='';return db[_0xf540('0x2f')][_0xf540('0x4e')]({'where':{'id':_0x2c84ca[_0xf540('0x47')]['id']},'attributes':['id',_0xf540('0x98'),_0xf540('0x99'),'email','remoteUri',_0xf540('0x9a')]})[_0xf540('0x17')](handleEntityNotFound(_0x305e73,null))[_0xf540('0x17')](function(_0x580387){if(_0x580387){_0xf0cb8=_0x580387['remoteUri'];var _0x2ab519=_0xf0cb8[_0xf540('0x9b')](-0x1);if(_0x2ab519==='/'){_0xf0cb8=_0xf0cb8[_0xf540('0x9c')](0x0,_0xf0cb8[_0xf540('0x9d')](_0x2ab519));}_0x5ebc76=util[_0xf540('0x9e')](_0xf540('0x9f'),_0xf0cb8);_0x9133b3=util[_0xf540('0x9e')]('%s/api/now/table/',_0xf0cb8);_0x58bd20={'user':_0x580387['username'],'pass':_0x580387[_0xf540('0x99')]};var _0x7f0907={'method':_0xf540('0xa0'),'uri':_0x5ebc76+_0xf540('0xa1'),'auth':_0x58bd20,'json':!![]};return rp(_0x7f0907);}})[_0xf540('0x17')](function(_0x356076){if(_0x356076[_0xf540('0x20')][_0xf540('0x3a')]>0x0){_0x508b68=_0x356076[_0xf540('0x20')];}console[_0xf540('0xa2')](_0xf540('0xa3'),_0x508b68);_0x1e67b2=[];_0xe2e366=Object['assign']([],_0x508b68);_['remove'](_0xe2e366,function(_0x5bf279){return!_0x23e304[_0xf540('0xa4')](_0x5bf279[_0xf540('0x2c')]);});_0xe2e366[_0xf540('0xa5')](function(_0x31e714){var _0x5324d0=createFieldObject(_0x9133b3,_0x58bd20,_0x31e714[_0xf540('0xa6')],_0x31e714[_0xf540('0x2c')],_0x31e714[_0xf540('0xa7')],![]);_0x1e67b2[_0xf540('0xa8')](_0x5324d0);});return Promise[_0xf540('0xa9')](_0x1e67b2);})['then'](function(_0x943ac8){_0x291a08=_0x943ac8;_0x2e4e6f=Object[_0xf540('0xaa')]([],_0x508b68);console[_0xf540('0xa2')](_0xf540('0xab'),_0x508b68);_[_0xf540('0xac')](_0x2e4e6f,function(_0x252056){return _0x301690['includes'](_0x252056[_0xf540('0x2c')]);});console['log'](_0xf540('0xad'),_0x2e4e6f);_0x1e67b2=[];_0x2e4e6f[_0xf540('0xa5')](function(_0x2bd64f){var _0x496b56=createFieldObject(_0x9133b3,_0x58bd20,_0x2bd64f['internalType'],_0x2bd64f['name'],_0x2bd64f['label'],!![]);_0x1e67b2['push'](_0x496b56);});return Promise[_0xf540('0xa9')](_0x1e67b2);})[_0xf540('0x17')](function(_0x32d7e6){_0x178147=_0x32d7e6;var _0x2f144f=_0x291a08['concat'](_0x178147);return{'count':_0x2f144f[_0xf540('0x3a')],'rows':_0x2f144f};})[_0xf540('0x17')](respondWithResult(_0x305e73,null))[_0xf540('0x21')](function(_0x3c7f8f){console[_0xf540('0xa2')](_0xf540('0xae')+_0x3c7f8f);var _0x4cb2d5=_0x2c84ca[_0xf540('0x33')][_0xf540('0xaf')]?0x1f4:_0x3c7f8f[_0xf540('0xb0')]||0x1f4;logger[_0xf540('0x1d')](_0x3c7f8f[_0xf540('0xb1')]);delete _0x3c7f8f['name'];if(_0x4cb2d5===0x191){_0x4cb2d5=0x190;}_0x305e73[_0xf540('0x23')](_0x4cb2d5)['send'](_0x2c84ca[_0xf540('0x33')][_0xf540('0xaf')]?{'message':_0xf540('0xb2'),'statusCode':_0x3c7f8f[_0xf540('0xb0')]}:_0x3c7f8f);});};function createFieldObject(_0x1a5f7a,_0x26ce08,_0x4ddfce,_0x371e2d,_0x3aae29,_0x4bf490){return new Promise(function(_0x489065,_0x54c32b){var _0x3e3c4c={'id':_0x371e2d,'name':_0x3aae29,'custom':_0x4bf490};if(_0x4ddfce===_0xf540('0xb3')){_0x3e3c4c[_0xf540('0x48')]=[{'name':_0xf540('0xb4'),'value':_0xf540('0xb5')},{'name':_0xf540('0xb6'),'value':'false'}];_0x489065(_0x3e3c4c);}else{var _0x142bae={'method':'GET','uri':_0x1a5f7a+_0xf540('0xb7')+_0x371e2d,'auth':_0x26ce08,'json':!![]};return rp(_0x142bae)['then'](function(_0x3b67ca){var _0x5988a8=[];if(_0x3b67ca[_0xf540('0x20')][_0xf540('0x3a')]>0x0){_0x3b67ca[_0xf540('0x20')][_0xf540('0xa5')](function(_0x114139){if(_0x114139[_0xf540('0xb8')]==='false'){var _0xca9e50={'name':_0x114139[_0xf540('0xa7')],'value':_0x114139['value']};_0x5988a8['push'](_0xca9e50);}});}_0x3e3c4c[_0xf540('0x48')]=_0x5988a8;if(_0x3e3c4c[_0xf540('0x48')][_0xf540('0x3a')]>0x0){_0x489065(_0x3e3c4c);}else{if(_0x4bf490==![]){_0x489065();}else{_0x489065(_0x3e3c4c);}}});}});}
\ No newline at end of file
+var _0x526c=['password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','includes','internalType','label','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','push','test','statusCode','Wrong\x20credentials','True','true','False','false','inactive','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','update','destroy','stack','name','send','index','ServicenowAccount','key','model','map','query','keys','attributes','intersection','fields','length','order','where','filters','pick','filter','type','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','merge','find','create','body','findOne','ServicenowConfiguration','sort','options','getConfigurations','hasOwnProperty','nolimit','Subjects','getSubjects','Descriptions','channel','ServicenowField','made_sla','hold_reason','knowledge','subcategory','close_code','notify','severity','parent','watch_list','upon_reject','child_incidents','approval_history','sys_updated_by','user_input','sys_domain','state','calendar_stc','cmdb_ci','delivery_plan','work_notes_list','priority','sys_domain_path','rfc','time_worked','opened_at','group_list','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','location','category','username'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x526c,0x191));var _0xc526=function(_0x1b2422,_0x1e98d4){_0x1b2422=_0x1b2422-0x0;var _0x376573=_0x526c[_0x1b2422];return _0x376573;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc526('0x0'));var zipdir=require(_0xc526('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc526('0x2'));var moment=require(_0xc526('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc526('0x4'));var util=require('util');var path=require(_0xc526('0x5'));var sox=require(_0xc526('0x6'));var csv=require(_0xc526('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc526('0x8'));var squel=require(_0xc526('0x9'));var crypto=require(_0xc526('0xa'));var jsforce=require(_0xc526('0xb'));var deskjs=require(_0xc526('0xc'));var toCsv=require(_0xc526('0x7'));var querystring=require(_0xc526('0xd'));var Papa=require(_0xc526('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc526('0xf'));var as=require(_0xc526('0x10'));var hardwareService=require(_0xc526('0x11'));var logger=require(_0xc526('0x12'))(_0xc526('0x13'));var utils=require('../../config/utils');var config=require(_0xc526('0x14'));var licenseUtil=require(_0xc526('0x15'));var db=require(_0xc526('0x16'))['db'];var integrations=require(_0xc526('0x17'));var jayson=require(_0xc526('0x18'));var client=jayson[_0xc526('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58dd10,_0x7935c1,_0x2b9031,_0x4765bb){return new BPromise(function(_0x2ca8b4,_0x3d9f72){var _0x142974=_0x4765bb||client;return _0x142974['request'](_0x58dd10,_0x2b9031)[_0xc526('0x1a')](function(_0x3f347c){logger[_0xc526('0x1b')](_0xc526('0x1c'),_0x7935c1,_0xc526('0x1d'));logger[_0xc526('0x1e')](_0xc526('0x1f'),_0x7935c1,_0xc526('0x1d'),JSON[_0xc526('0x20')](_0x3f347c));if(_0x3f347c[_0xc526('0x21')]){if(_0x3f347c[_0xc526('0x21')]['code']===0x1f4){logger[_0xc526('0x21')](_0xc526('0x1c'),_0x7935c1,_0x3f347c[_0xc526('0x21')][_0xc526('0x22')]);return _0x3d9f72(_0x3f347c[_0xc526('0x21')][_0xc526('0x22')]);}logger[_0xc526('0x21')](_0xc526('0x1c'),_0x7935c1,_0x3f347c[_0xc526('0x21')]['message']);return _0x2ca8b4(_0x3f347c[_0xc526('0x21')][_0xc526('0x22')]);}else{logger[_0xc526('0x1b')](_0xc526('0x1c'),_0x7935c1,'request\x20sent');_0x2ca8b4(_0x3f347c[_0xc526('0x23')][_0xc526('0x22')]);}})[_0xc526('0x24')](function(_0x33bbea){logger[_0xc526('0x21')]('ServicenowAccount,\x20%s,\x20%s',_0x7935c1,_0x33bbea);_0x3d9f72(_0x33bbea);});});}function respondWithStatusCode(_0x30a2dd,_0x5a7dc3){_0x5a7dc3=_0x5a7dc3||0xcc;return function(_0x213d19){if(_0x213d19){return _0x30a2dd[_0xc526('0x25')](_0x5a7dc3);}return _0x30a2dd[_0xc526('0x26')](_0x5a7dc3)[_0xc526('0x27')]();};}function respondWithResult(_0x4eb235,_0x4b722c){_0x4b722c=_0x4b722c||0xc8;return function(_0x55e9fb){if(_0x55e9fb){return _0x4eb235[_0xc526('0x26')](_0x4b722c)[_0xc526('0x28')](_0x55e9fb);}};}function respondWithFilteredResult(_0x2fa1ed,_0x475880){return function(_0x3302c5){if(_0x3302c5){var _0x5284e3=_0x3302c5[_0xc526('0x29')],_0x3e002c=_0x475880['offset'],_0x3753e9=_0x475880[_0xc526('0x2a')]+_0x475880[_0xc526('0x2b')],_0x475861;if(_0x3753e9>=_0x5284e3){_0x3753e9=_0x5284e3;_0x475861=0xc8;}else{_0x475861=0xce;}_0x2fa1ed[_0xc526('0x26')](_0x475861);return _0x2fa1ed[_0xc526('0x2c')]('Content-Range',_0x3e002c+'-'+_0x3753e9+'/'+_0x5284e3)[_0xc526('0x28')](_0x3302c5);}return null;};}function patchUpdates(_0x51e6aa){return function(_0x2c64d8){try{jsonpatch[_0xc526('0x2d')](_0x2c64d8,_0x51e6aa,!![]);}catch(_0x767795){return BPromise['reject'](_0x767795);}return _0x2c64d8['save']();};}function saveUpdates(_0x371bc5,_0x4bc950){return function(_0x2eab70){if(_0x2eab70){return _0x2eab70[_0xc526('0x2e')](_0x371bc5)['then'](function(_0x3b12ff){return _0x3b12ff;});}return null;};}function removeEntity(_0x1dbc1a,_0x4a6682){return function(_0x214837){if(_0x214837){return _0x214837[_0xc526('0x2f')]()['then'](function(){_0x1dbc1a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26d235,_0x8c1846){return function(_0x10c0e3){if(!_0x10c0e3){_0x26d235[_0xc526('0x25')](0x194);}return _0x10c0e3;};}function handleError(_0x4041b4,_0x16bb8e){_0x16bb8e=_0x16bb8e||0x1f4;return function(_0x1bafed){logger['error'](_0x1bafed[_0xc526('0x30')]);if(_0x1bafed['name']){delete _0x1bafed[_0xc526('0x31')];}_0x4041b4[_0xc526('0x26')](_0x16bb8e)[_0xc526('0x32')](_0x1bafed);};}exports[_0xc526('0x33')]=function(_0x30baba,_0x1cf45f){var _0x392e4e={},_0x4c39f1={},_0x134910={'count':0x0,'rows':[]};var _0x4da7de=_['map'](db[_0xc526('0x34')]['rawAttributes'],function(_0xde5e85){return{'name':_0xde5e85['fieldName'],'type':_0xde5e85['type'][_0xc526('0x35')]};});_0x4c39f1[_0xc526('0x36')]=_[_0xc526('0x37')](_0x4da7de,_0xc526('0x31'));_0x4c39f1[_0xc526('0x38')]=_[_0xc526('0x39')](_0x30baba[_0xc526('0x38')]);_0x4c39f1['filters']=_['intersection'](_0x4c39f1['model'],_0x4c39f1['query']);_0x392e4e[_0xc526('0x3a')]=_[_0xc526('0x3b')](_0x4c39f1[_0xc526('0x36')],qs[_0xc526('0x3c')](_0x30baba[_0xc526('0x38')][_0xc526('0x3c')]));_0x392e4e[_0xc526('0x3a')]=_0x392e4e[_0xc526('0x3a')][_0xc526('0x3d')]?_0x392e4e['attributes']:_0x4c39f1[_0xc526('0x36')];if(!_0x30baba['query']['hasOwnProperty']('nolimit')){_0x392e4e[_0xc526('0x2b')]=qs['limit'](_0x30baba[_0xc526('0x38')]['limit']);_0x392e4e[_0xc526('0x2a')]=qs[_0xc526('0x2a')](_0x30baba[_0xc526('0x38')]['offset']);}_0x392e4e[_0xc526('0x3e')]=qs['sort'](_0x30baba['query']['sort']);_0x392e4e[_0xc526('0x3f')]=qs[_0xc526('0x40')](_[_0xc526('0x41')](_0x30baba['query'],_0x4c39f1['filters']),_0x4da7de);if(_0x30baba[_0xc526('0x38')][_0xc526('0x42')]){_0x392e4e[_0xc526('0x3f')]=_['merge'](_0x392e4e['where'],{'$or':_['map'](_0x4da7de,function(_0x2f4522){if(_0x2f4522[_0xc526('0x43')]!==_0xc526('0x44')){var _0x6eb135={};_0x6eb135[_0x2f4522[_0xc526('0x31')]]={'$like':'%'+_0x30baba[_0xc526('0x38')]['filter']+'%'};return _0x6eb135;}})});}_0x392e4e=_['merge']({},_0x392e4e,_0x30baba['options']);var _0x51c155={'where':_0x392e4e[_0xc526('0x3f')]};return db[_0xc526('0x34')][_0xc526('0x29')](_0x51c155)['then'](function(_0x4dc9f1){_0x134910[_0xc526('0x29')]=_0x4dc9f1;if(_0x30baba[_0xc526('0x38')][_0xc526('0x45')]){_0x392e4e[_0xc526('0x46')]=[{'all':!![]}];}return db[_0xc526('0x34')][_0xc526('0x47')](_0x392e4e);})[_0xc526('0x1a')](function(_0x5c85f2){_0x134910[_0xc526('0x48')]=_0x5c85f2;return _0x134910;})[_0xc526('0x1a')](respondWithFilteredResult(_0x1cf45f,_0x392e4e))['catch'](handleError(_0x1cf45f,null));};exports[_0xc526('0x49')]=function(_0x41ba25,_0x541f33){var _0x12ad01={'raw':![],'where':{'id':_0x41ba25[_0xc526('0x4a')]['id']}},_0x535dab={};_0x535dab[_0xc526('0x36')]=_[_0xc526('0x39')](db[_0xc526('0x34')][_0xc526('0x4b')]);_0x535dab[_0xc526('0x38')]=_[_0xc526('0x39')](_0x41ba25[_0xc526('0x38')]);_0x535dab[_0xc526('0x40')]=_['intersection'](_0x535dab[_0xc526('0x36')],_0x535dab[_0xc526('0x38')]);_0x12ad01[_0xc526('0x3a')]=_['intersection'](_0x535dab[_0xc526('0x36')],qs[_0xc526('0x3c')](_0x41ba25[_0xc526('0x38')][_0xc526('0x3c')]));_0x12ad01[_0xc526('0x3a')]=_0x12ad01['attributes'][_0xc526('0x3d')]?_0x12ad01[_0xc526('0x3a')]:_0x535dab[_0xc526('0x36')];if(_0x41ba25[_0xc526('0x38')][_0xc526('0x45')]){_0x12ad01['include']=[{'all':!![]}];}_0x12ad01=_[_0xc526('0x4c')]({},_0x12ad01,_0x41ba25['options']);return db[_0xc526('0x34')][_0xc526('0x4d')](_0x12ad01)['then'](handleEntityNotFound(_0x541f33,null))[_0xc526('0x1a')](respondWithResult(_0x541f33,null))['catch'](handleError(_0x541f33,null));};exports[_0xc526('0x4e')]=function(_0x2ccbdb,_0x5d888c){return db[_0xc526('0x34')][_0xc526('0x4e')](_0x2ccbdb['body'],{})[_0xc526('0x1a')](respondWithResult(_0x5d888c,0xc9))[_0xc526('0x24')](handleError(_0x5d888c,null));};exports[_0xc526('0x2e')]=function(_0x552611,_0x16b2de){if(_0x552611[_0xc526('0x4f')]['id']){delete _0x552611[_0xc526('0x4f')]['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x552611[_0xc526('0x4a')]['id']}})[_0xc526('0x1a')](handleEntityNotFound(_0x16b2de,null))[_0xc526('0x1a')](saveUpdates(_0x552611['body'],null))[_0xc526('0x1a')](respondWithResult(_0x16b2de,null))['catch'](handleError(_0x16b2de,null));};exports[_0xc526('0x2f')]=function(_0xe75ef2,_0x402ef0){return db[_0xc526('0x34')][_0xc526('0x4d')]({'where':{'id':_0xe75ef2[_0xc526('0x4a')]['id']}})[_0xc526('0x1a')](handleEntityNotFound(_0x402ef0,null))[_0xc526('0x1a')](removeEntity(_0x402ef0,null))[_0xc526('0x24')](handleError(_0x402ef0,null));};exports['getConfigurations']=function(_0x32e0f8,_0x3a2f26,_0x3b983f){var _0x311ac8={};var _0x25d697={};var _0x2aded3;var _0xa24a24;return db['ServicenowAccount'][_0xc526('0x50')]({'where':{'id':_0x32e0f8['params']['id']}})[_0xc526('0x1a')](handleEntityNotFound(_0x3a2f26,null))[_0xc526('0x1a')](function(_0x4056f5){if(_0x4056f5){_0x2aded3=_0x4056f5;_0x25d697[_0xc526('0x36')]=_[_0xc526('0x39')](db[_0xc526('0x51')][_0xc526('0x4b')]);_0x25d697[_0xc526('0x38')]=_[_0xc526('0x39')](_0x32e0f8[_0xc526('0x38')]);_0x25d697[_0xc526('0x40')]=_[_0xc526('0x3b')](_0x25d697[_0xc526('0x36')],_0x25d697['query']);_0x311ac8['attributes']=_[_0xc526('0x3b')](_0x25d697[_0xc526('0x36')],qs['fields'](_0x32e0f8[_0xc526('0x38')][_0xc526('0x3c')]));_0x311ac8[_0xc526('0x3a')]=_0x311ac8[_0xc526('0x3a')]['length']?_0x311ac8[_0xc526('0x3a')]:_0x25d697[_0xc526('0x36')];_0x311ac8[_0xc526('0x3e')]=qs[_0xc526('0x52')](_0x32e0f8[_0xc526('0x38')][_0xc526('0x52')]);_0x311ac8[_0xc526('0x3f')]=qs[_0xc526('0x40')](_[_0xc526('0x41')](_0x32e0f8[_0xc526('0x38')],_0x25d697[_0xc526('0x40')]));if(_0x32e0f8[_0xc526('0x38')][_0xc526('0x42')]){_0x311ac8[_0xc526('0x3f')]=_[_0xc526('0x4c')](_0x311ac8[_0xc526('0x3f')],{'$or':_['map'](_0x311ac8[_0xc526('0x3a')],function(_0x500782){var _0x544146={};_0x544146[_0x500782]={'$like':'%'+_0x32e0f8['query'][_0xc526('0x42')]+'%'};return _0x544146;})});}_0x311ac8=_[_0xc526('0x4c')]({},_0x311ac8,_0x32e0f8[_0xc526('0x53')]);return _0x2aded3[_0xc526('0x54')](_0x311ac8);}})['then'](function(_0x593d7d){if(_0x593d7d){_0xa24a24=_0x593d7d[_0xc526('0x3d')];if(!_0x32e0f8[_0xc526('0x38')][_0xc526('0x55')](_0xc526('0x56'))){_0x311ac8[_0xc526('0x2b')]=qs[_0xc526('0x2b')](_0x32e0f8[_0xc526('0x38')][_0xc526('0x2b')]);_0x311ac8['offset']=qs['offset'](_0x32e0f8[_0xc526('0x38')][_0xc526('0x2a')]);}return _0x2aded3[_0xc526('0x54')](_0x311ac8);}})[_0xc526('0x1a')](function(_0x11a082){if(_0x11a082){return _0x11a082?{'count':_0xa24a24,'rows':_0x11a082}:null;}})[_0xc526('0x1a')](respondWithResult(_0x3a2f26,null))[_0xc526('0x24')](handleError(_0x3a2f26,null));};exports['addConfiguration']=function(_0x2a3a7f,_0x3e9c90,_0x50a53c){if(_0x2a3a7f['body']['id']){delete _0x2a3a7f[_0xc526('0x4f')]['id'];}return db[_0xc526('0x34')][_0xc526('0x50')]({'where':{'id':_0x2a3a7f[_0xc526('0x4a')]['id']}})[_0xc526('0x1a')](handleEntityNotFound(_0x3e9c90,null))[_0xc526('0x1a')](function(_0xd8f288){if(_0xd8f288){_0x2a3a7f[_0xc526('0x4f')]['AccountId']=_0xd8f288['id'];_0x2a3a7f[_0xc526('0x4f')][_0xc526('0x57')]=integrations[_0xc526('0x58')](_0x2a3a7f[_0xc526('0x4f')]['channel'],_0x2a3a7f['body'][_0xc526('0x43')]);_0x2a3a7f[_0xc526('0x4f')][_0xc526('0x59')]=integrations['getDescriptions'](_0x2a3a7f['body'][_0xc526('0x5a')],_0x2a3a7f[_0xc526('0x4f')]['type']);return db['ServicenowConfiguration']['create'](_0x2a3a7f[_0xc526('0x4f')],{'include':[{'model':db[_0xc526('0x5b')],'as':'Subjects'},{'model':db[_0xc526('0x5b')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x3e9c90,null))[_0xc526('0x24')](handleError(_0x3e9c90,null));};exports['getFields']=function(_0xc21a96,_0x2dc77e,_0x403222){var _0xd7ea08=[_0xc526('0x5c'),_0xc526('0x5d'),_0xc526('0x5e'),_0xc526('0x5f'),_0xc526('0x60'),_0xc526('0x61'),'incident_state',_0xc526('0x62'),'category'];var _0x20d0fd=[_0xc526('0x63'),_0xc526('0x5c'),'caused_by',_0xc526('0x64'),_0xc526('0x65'),'sys_updated_on',_0xc526('0x66'),_0xc526('0x5d'),_0xc526('0x67'),'number','resolved_by',_0xc526('0x68'),'opened_by',_0xc526('0x69'),'sys_created_on',_0xc526('0x6a'),_0xc526('0x6b'),'sys_created_by','knowledge','order',_0xc526('0x6c'),'closed_at',_0xc526('0x6d'),_0xc526('0x6e'),'impact','active',_0xc526('0x6f'),'business_service',_0xc526('0x70'),_0xc526('0x71'),_0xc526('0x72'),_0xc526('0x73'),'expected_start',_0xc526('0x74'),'business_duration',_0xc526('0x75'),'work_end',_0xc526('0x76'),_0xc526('0x77'),_0xc526('0x78'),_0xc526('0x79'),_0xc526('0x5f'),_0xc526('0x7a'),_0xc526('0x7b'),_0xc526('0x60'),'correlation_display',_0xc526('0x7c'),_0xc526('0x7d'),'assignment_group',_0xc526('0x7e'),_0xc526('0x7f'),_0xc526('0x80'),_0xc526('0x81'),'notify',_0xc526('0x82'),_0xc526('0x83'),'closed_by',_0xc526('0x84'),_0xc526('0x85'),_0xc526('0x86'),'contact_type',_0xc526('0x87'),_0xc526('0x88'),_0xc526('0x89'),_0xc526('0x8a'),_0xc526('0x8b'),_0xc526('0x8c'),_0xc526('0x8d'),_0xc526('0x8e'),_0xc526('0x62'),'comments',_0xc526('0x8f'),_0xc526('0x90'),_0xc526('0x91'),_0xc526('0x92'),_0xc526('0x93'),_0xc526('0x94'),_0xc526('0x95'),_0xc526('0x96'),'upon_approval','correlation_id',_0xc526('0x97'),_0xc526('0x98')];var _0x1d6c19='';var _0x2b943b='';var _0x5760b8=[];var _0x2c1b13='';var _0x57f0fa='';var _0x189548=[];var _0x50591a='';var _0x5b2c07='';var _0x29b073={};var _0x736a6b='';return db[_0xc526('0x34')]['findOne']({'where':{'id':_0xc21a96[_0xc526('0x4a')]['id']},'attributes':['id',_0xc526('0x99'),_0xc526('0x9a'),_0xc526('0x9b'),_0xc526('0x9c'),_0xc526('0x9d')]})[_0xc526('0x1a')](handleEntityNotFound(_0x2dc77e,null))[_0xc526('0x1a')](function(_0x5c8dbc){if(_0x5c8dbc){_0x736a6b=_0x5c8dbc[_0xc526('0x9c')];var _0x2fb9d9=_0x736a6b[_0xc526('0x9e')](-0x1);if(_0x2fb9d9==='/'){_0x736a6b=_0x736a6b[_0xc526('0x9f')](0x0,_0x736a6b[_0xc526('0xa0')](_0x2fb9d9));}_0x5b2c07=util[_0xc526('0xa1')]('%s/api/now/doc/table/schema/',_0x736a6b);_0x50591a=util[_0xc526('0xa1')](_0xc526('0xa2'),_0x736a6b);_0x29b073={'user':_0x5c8dbc[_0xc526('0x99')],'pass':_0x5c8dbc[_0xc526('0x9a')]};var _0x2868c1={'method':_0xc526('0xa3'),'uri':_0x5b2c07+_0xc526('0xa4'),'auth':_0x29b073,'json':!![]};return rp(_0x2868c1);}})[_0xc526('0x1a')](function(_0xba79d9){if(_0xba79d9['result'][_0xc526('0x3d')]>0x0){_0x1d6c19=_0xba79d9['result'];}console[_0xc526('0xa5')](_0xc526('0xa6'),_0x1d6c19);_0x189548=[];_0x2b943b=Object[_0xc526('0xa7')]([],_0x1d6c19);_[_0xc526('0xa8')](_0x2b943b,function(_0x5d0162){return!_0xd7ea08[_0xc526('0xa9')](_0x5d0162[_0xc526('0x31')]);});_0x2b943b['forEach'](function(_0x3c416c){var _0x2e2639=createFieldObject(_0x50591a,_0x29b073,_0x3c416c[_0xc526('0xaa')],_0x3c416c[_0xc526('0x31')],_0x3c416c[_0xc526('0xab')],![]);_0x189548['push'](_0x2e2639);});return Promise[_0xc526('0xac')](_0x189548);})[_0xc526('0x1a')](function(_0x38dc69){_0x5760b8=_0x38dc69;_0x2c1b13=Object[_0xc526('0xa7')]([],_0x1d6c19);console[_0xc526('0xa5')](_0xc526('0xad'),_0x1d6c19);_['remove'](_0x2c1b13,function(_0xc529f){return _0x20d0fd['includes'](_0xc529f[_0xc526('0x31')]);});console[_0xc526('0xa5')](_0xc526('0xae'),_0x2c1b13);_0x189548=[];_0x2c1b13[_0xc526('0xaf')](function(_0x3a9f89){var _0xec23e0=createFieldObject(_0x50591a,_0x29b073,_0x3a9f89[_0xc526('0xaa')],_0x3a9f89[_0xc526('0x31')],_0x3a9f89[_0xc526('0xab')],!![]);_0x189548[_0xc526('0xb0')](_0xec23e0);});return Promise['all'](_0x189548);})[_0xc526('0x1a')](function(_0x261bdc){_0x57f0fa=_0x261bdc;var _0x5c32c1=_0x5760b8['concat'](_0x57f0fa);return{'count':_0x5c32c1['length'],'rows':_0x5c32c1};})['then'](respondWithResult(_0x2dc77e,null))['catch'](function(_0x248da8){console[_0xc526('0xa5')]('ServiceNow\x20error:\x20'+_0x248da8);var _0x100e61=_0xc21a96[_0xc526('0x38')][_0xc526('0xb1')]?0x1f4:_0x248da8[_0xc526('0xb2')]||0x1f4;logger[_0xc526('0x21')](_0x248da8[_0xc526('0x30')]);delete _0x248da8[_0xc526('0x31')];if(_0x100e61===0x191){_0x100e61=0x190;}_0x2dc77e[_0xc526('0x26')](_0x100e61)[_0xc526('0x32')](_0xc21a96['query'][_0xc526('0xb1')]?{'message':_0xc526('0xb3'),'statusCode':_0x248da8[_0xc526('0xb2')]}:_0x248da8);});};function createFieldObject(_0x5d6e79,_0x4ad9de,_0x4c08a0,_0x4f3e41,_0x41a416,_0x41154c){return new Promise(function(_0x311a37,_0x341be0){var _0xc782ff={'id':_0x4f3e41,'name':_0x41a416,'custom':_0x41154c};if(_0x4c08a0==='boolean'){_0xc782ff['options']=[{'name':_0xc526('0xb4'),'value':_0xc526('0xb5')},{'name':_0xc526('0xb6'),'value':_0xc526('0xb7')}];_0x311a37(_0xc782ff);}else{var _0xb538d3={'method':'GET','uri':_0x5d6e79+'sys_choice?sysparm_query=name=incident^element='+_0x4f3e41,'auth':_0x4ad9de,'json':!![]};return rp(_0xb538d3)[_0xc526('0x1a')](function(_0x5c2ba0){var _0x319132=[];if(_0x5c2ba0[_0xc526('0x23')][_0xc526('0x3d')]>0x0){_0x5c2ba0[_0xc526('0x23')][_0xc526('0xaf')](function(_0x45417b){if(_0x45417b[_0xc526('0xb8')]===_0xc526('0xb7')){var _0x39d522={'name':_0x45417b[_0xc526('0xab')],'value':_0x45417b['value']};_0x319132[_0xc526('0xb0')](_0x39d522);}});}_0xc782ff['options']=_0x319132;if(_0xc782ff['options'][_0xc526('0x3d')]>0x0){_0x311a37(_0xc782ff);}else{if(_0x41154c==![]){_0x311a37();}else{_0x311a37(_0xc782ff);}}});}});}
\ No newline at end of file