Built motion from commit 97153652.|2.6.26
[motion2.git] / server / api / intServicenowAccount / intServicenowAccount.controller.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xfc58=['findOne','ServicenowConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','Subjects','made_sla','hold_reason','subcategory','close_code','severity','category','parent','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','cmdb_ci','delivery_plan','impact','active','work_notes_list','priority','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','work_notes','correlation_display','work_start','assignment_group','business_stc','description','notify','sys_class_name','close_notes','parent_incident','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','email','remoteUri','serverUrl','substring','lastIndexOf','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','assign','includes','forEach','label','push','all','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','test','statusCode','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','rimraf','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','ServicenowAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','getConfigurations'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xfc58,0x1c1));var _0x8fc5=function(_0x7eb3ad,_0x571c4e){_0x7eb3ad=_0x7eb3ad-0x0;var _0x19816b=_0xfc58[_0x7eb3ad];return _0x19816b;};'use strict';var emlformat=require(_0x8fc5('0x0'));var rimraf=require(_0x8fc5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8fc5('0x2'));var moment=require(_0x8fc5('0x3'));var BPromise=require(_0x8fc5('0x4'));var Mustache=require('mustache');var util=require(_0x8fc5('0x5'));var path=require('path');var sox=require(_0x8fc5('0x6'));var csv=require(_0x8fc5('0x7'));var ejs=require(_0x8fc5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8fc5('0x9'));var squel=require(_0x8fc5('0xa'));var crypto=require(_0x8fc5('0xb'));var jsforce=require(_0x8fc5('0xc'));var deskjs=require(_0x8fc5('0xd'));var toCsv=require(_0x8fc5('0x7'));var querystring=require(_0x8fc5('0xe'));var Papa=require(_0x8fc5('0xf'));var Redis=require('ioredis');var authService=require(_0x8fc5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8fc5('0x11'));var hardwareService=require(_0x8fc5('0x12'));var logger=require(_0x8fc5('0x13'))(_0x8fc5('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8fc5('0x15'));var db=require(_0x8fc5('0x16'))['db'];var integrations=require(_0x8fc5('0x17'));function respondWithStatusCode(_0x474c7c,_0x44c747){_0x44c747=_0x44c747||0xcc;return function(_0x6db857){if(_0x6db857){return _0x474c7c[_0x8fc5('0x18')](_0x44c747);}return _0x474c7c[_0x8fc5('0x19')](_0x44c747)[_0x8fc5('0x1a')]();};}function respondWithResult(_0xb77bdf,_0x567b29){_0x567b29=_0x567b29||0xc8;return function(_0x49e8a1){if(_0x49e8a1){return _0xb77bdf[_0x8fc5('0x19')](_0x567b29)[_0x8fc5('0x1b')](_0x49e8a1);}};}function respondWithFilteredResult(_0x53a054,_0x5ea7ca){return function(_0x5e6581){if(_0x5e6581){var _0x5e04e2=typeof _0x5ea7ca[_0x8fc5('0x1c')]===_0x8fc5('0x1d')&&typeof _0x5ea7ca[_0x8fc5('0x1e')]==='undefined';var _0x4edbc5=_0x5e6581[_0x8fc5('0x1f')];var _0x20156b=_0x5e04e2?0x0:_0x5ea7ca[_0x8fc5('0x1c')];var _0x2305e9=_0x5e04e2?_0x5e6581[_0x8fc5('0x1f')]:_0x5ea7ca['offset']+_0x5ea7ca['limit'];var _0x5e21f2;if(_0x2305e9>=_0x4edbc5){_0x2305e9=_0x4edbc5;_0x5e21f2=0xc8;}else{_0x5e21f2=0xce;}_0x53a054[_0x8fc5('0x19')](_0x5e21f2);return _0x53a054['set'](_0x8fc5('0x20'),_0x20156b+'-'+_0x2305e9+'/'+_0x4edbc5)[_0x8fc5('0x1b')](_0x5e6581);}return null;};}function patchUpdates(_0x1dc57e){return function(_0x2c857a){try{jsonpatch[_0x8fc5('0x21')](_0x2c857a,_0x1dc57e,!![]);}catch(_0x16346e){return BPromise[_0x8fc5('0x22')](_0x16346e);}return _0x2c857a['save']();};}function saveUpdates(_0x5726c0,_0x24f197){return function(_0x385a4a){if(_0x385a4a){return _0x385a4a[_0x8fc5('0x23')](_0x5726c0)[_0x8fc5('0x24')](function(_0x35e509){return _0x35e509;});}return null;};}function removeEntity(_0x364231,_0x34b140){return function(_0x29dc72){if(_0x29dc72){return _0x29dc72[_0x8fc5('0x25')]()[_0x8fc5('0x24')](function(){_0x364231[_0x8fc5('0x19')](0xcc)[_0x8fc5('0x1a')]();});}};}function handleEntityNotFound(_0x34429e,_0x447821){return function(_0xa71486){if(!_0xa71486){_0x34429e[_0x8fc5('0x18')](0x194);}return _0xa71486;};}function handleError(_0x2873c9,_0x207de9){_0x207de9=_0x207de9||0x1f4;return function(_0xb0112c){logger[_0x8fc5('0x26')](_0xb0112c[_0x8fc5('0x27')]);if(_0xb0112c['name']){delete _0xb0112c[_0x8fc5('0x28')];}_0x2873c9[_0x8fc5('0x19')](_0x207de9)[_0x8fc5('0x29')](_0xb0112c);};}exports['index']=function(_0x4803e8,_0x5c8a87){var _0x339ca4={},_0x34c820={},_0x314eeb={'count':0x0,'rows':[]};var _0x573e79=_['map'](db[_0x8fc5('0x2a')][_0x8fc5('0x2b')],function(_0x86569d){return{'name':_0x86569d[_0x8fc5('0x2c')],'type':_0x86569d['type'][_0x8fc5('0x2d')]};});_0x34c820[_0x8fc5('0x2e')]=_['map'](_0x573e79,_0x8fc5('0x28'));_0x34c820[_0x8fc5('0x2f')]=_[_0x8fc5('0x30')](_0x4803e8['query']);_0x34c820[_0x8fc5('0x31')]=_[_0x8fc5('0x32')](_0x34c820[_0x8fc5('0x2e')],_0x34c820['query']);_0x339ca4[_0x8fc5('0x33')]=_['intersection'](_0x34c820[_0x8fc5('0x2e')],qs[_0x8fc5('0x34')](_0x4803e8[_0x8fc5('0x2f')]['fields']));_0x339ca4['attributes']=_0x339ca4[_0x8fc5('0x33')]['length']?_0x339ca4['attributes']:_0x34c820['model'];if(!_0x4803e8['query'][_0x8fc5('0x35')](_0x8fc5('0x36'))){_0x339ca4[_0x8fc5('0x1e')]=qs[_0x8fc5('0x1e')](_0x4803e8[_0x8fc5('0x2f')][_0x8fc5('0x1e')]);_0x339ca4['offset']=qs[_0x8fc5('0x1c')](_0x4803e8[_0x8fc5('0x2f')][_0x8fc5('0x1c')]);}_0x339ca4[_0x8fc5('0x37')]=qs[_0x8fc5('0x38')](_0x4803e8[_0x8fc5('0x2f')]['sort']);_0x339ca4[_0x8fc5('0x39')]=qs[_0x8fc5('0x31')](_[_0x8fc5('0x3a')](_0x4803e8[_0x8fc5('0x2f')],_0x34c820['filters']),_0x573e79);if(_0x4803e8[_0x8fc5('0x2f')][_0x8fc5('0x3b')]){_0x339ca4[_0x8fc5('0x39')]=_[_0x8fc5('0x3c')](_0x339ca4[_0x8fc5('0x39')],{'$or':_[_0x8fc5('0x3d')](_0x573e79,function(_0x4979c2){if(_0x4979c2[_0x8fc5('0x3e')]!=='VIRTUAL'){var _0x432ad7={};_0x432ad7[_0x4979c2['name']]={'$like':'%'+_0x4803e8[_0x8fc5('0x2f')]['filter']+'%'};return _0x432ad7;}})});}_0x339ca4=_[_0x8fc5('0x3c')]({},_0x339ca4,_0x4803e8[_0x8fc5('0x3f')]);var _0x53ccce={'where':_0x339ca4[_0x8fc5('0x39')]};return db[_0x8fc5('0x2a')][_0x8fc5('0x1f')](_0x53ccce)[_0x8fc5('0x24')](function(_0x53528f){_0x314eeb[_0x8fc5('0x1f')]=_0x53528f;if(_0x4803e8[_0x8fc5('0x2f')][_0x8fc5('0x40')]){_0x339ca4[_0x8fc5('0x41')]=[{'all':!![]}];}return db[_0x8fc5('0x2a')][_0x8fc5('0x42')](_0x339ca4);})[_0x8fc5('0x24')](function(_0x172c45){_0x314eeb[_0x8fc5('0x43')]=_0x172c45;return _0x314eeb;})[_0x8fc5('0x24')](respondWithFilteredResult(_0x5c8a87,_0x339ca4))[_0x8fc5('0x44')](handleError(_0x5c8a87,null));};exports[_0x8fc5('0x45')]=function(_0xb49562,_0x1e5d39){var _0x293758={'raw':![],'where':{'id':_0xb49562[_0x8fc5('0x46')]['id']}},_0x1cd1a0={};_0x1cd1a0[_0x8fc5('0x2e')]=_['keys'](db[_0x8fc5('0x2a')][_0x8fc5('0x2b')]);_0x1cd1a0[_0x8fc5('0x2f')]=_[_0x8fc5('0x30')](_0xb49562[_0x8fc5('0x2f')]);_0x1cd1a0[_0x8fc5('0x31')]=_[_0x8fc5('0x32')](_0x1cd1a0[_0x8fc5('0x2e')],_0x1cd1a0['query']);_0x293758[_0x8fc5('0x33')]=_[_0x8fc5('0x32')](_0x1cd1a0[_0x8fc5('0x2e')],qs[_0x8fc5('0x34')](_0xb49562['query']['fields']));_0x293758[_0x8fc5('0x33')]=_0x293758['attributes'][_0x8fc5('0x47')]?_0x293758[_0x8fc5('0x33')]:_0x1cd1a0[_0x8fc5('0x2e')];if(_0xb49562[_0x8fc5('0x2f')][_0x8fc5('0x40')]){_0x293758['include']=[{'all':!![]}];}_0x293758=_[_0x8fc5('0x3c')]({},_0x293758,_0xb49562[_0x8fc5('0x3f')]);return db['ServicenowAccount']['find'](_0x293758)[_0x8fc5('0x24')](handleEntityNotFound(_0x1e5d39,null))[_0x8fc5('0x24')](respondWithResult(_0x1e5d39,null))['catch'](handleError(_0x1e5d39,null));};exports[_0x8fc5('0x48')]=function(_0xb75b50,_0x2ba526){return db[_0x8fc5('0x2a')][_0x8fc5('0x48')](_0xb75b50[_0x8fc5('0x49')],{})['then'](respondWithResult(_0x2ba526,0xc9))[_0x8fc5('0x44')](handleError(_0x2ba526,null));};exports[_0x8fc5('0x23')]=function(_0x53eecb,_0x4fc4fc){if(_0x53eecb['body']['id']){delete _0x53eecb['body']['id'];}return db[_0x8fc5('0x2a')][_0x8fc5('0x4a')]({'where':{'id':_0x53eecb['params']['id']}})[_0x8fc5('0x24')](handleEntityNotFound(_0x4fc4fc,null))['then'](saveUpdates(_0x53eecb[_0x8fc5('0x49')],null))[_0x8fc5('0x24')](respondWithResult(_0x4fc4fc,null))[_0x8fc5('0x44')](handleError(_0x4fc4fc,null));};exports[_0x8fc5('0x25')]=function(_0x73f84e,_0x2913b9){return db[_0x8fc5('0x2a')][_0x8fc5('0x4a')]({'where':{'id':_0x73f84e['params']['id']}})[_0x8fc5('0x24')](handleEntityNotFound(_0x2913b9,null))[_0x8fc5('0x24')](removeEntity(_0x2913b9,null))['catch'](handleError(_0x2913b9,null));};exports[_0x8fc5('0x4b')]=function(_0x48af05,_0xa834dd,_0x380205){var _0x5a241f={};var _0x99d9f4={};var _0x1202ac;var _0x29375c;return db['ServicenowAccount'][_0x8fc5('0x4c')]({'where':{'id':_0x48af05[_0x8fc5('0x46')]['id']}})[_0x8fc5('0x24')](handleEntityNotFound(_0xa834dd,null))[_0x8fc5('0x24')](function(_0x16abc8){if(_0x16abc8){_0x1202ac=_0x16abc8;_0x99d9f4[_0x8fc5('0x2e')]=_[_0x8fc5('0x30')](db[_0x8fc5('0x4d')][_0x8fc5('0x2b')]);_0x99d9f4[_0x8fc5('0x2f')]=_['keys'](_0x48af05[_0x8fc5('0x2f')]);_0x99d9f4[_0x8fc5('0x31')]=_[_0x8fc5('0x32')](_0x99d9f4[_0x8fc5('0x2e')],_0x99d9f4[_0x8fc5('0x2f')]);_0x5a241f[_0x8fc5('0x33')]=_[_0x8fc5('0x32')](_0x99d9f4['model'],qs[_0x8fc5('0x34')](_0x48af05[_0x8fc5('0x2f')][_0x8fc5('0x34')]));_0x5a241f[_0x8fc5('0x33')]=_0x5a241f[_0x8fc5('0x33')][_0x8fc5('0x47')]?_0x5a241f[_0x8fc5('0x33')]:_0x99d9f4[_0x8fc5('0x2e')];_0x5a241f[_0x8fc5('0x37')]=qs[_0x8fc5('0x38')](_0x48af05[_0x8fc5('0x2f')][_0x8fc5('0x38')]);_0x5a241f[_0x8fc5('0x39')]=qs[_0x8fc5('0x31')](_[_0x8fc5('0x3a')](_0x48af05[_0x8fc5('0x2f')],_0x99d9f4['filters']));if(_0x48af05[_0x8fc5('0x2f')][_0x8fc5('0x3b')]){_0x5a241f[_0x8fc5('0x39')]=_[_0x8fc5('0x3c')](_0x5a241f['where'],{'$or':_[_0x8fc5('0x3d')](_0x5a241f[_0x8fc5('0x33')],function(_0x4907a3){var _0x3a073c={};_0x3a073c[_0x4907a3]={'$like':'%'+_0x48af05[_0x8fc5('0x2f')][_0x8fc5('0x3b')]+'%'};return _0x3a073c;})});}_0x5a241f=_[_0x8fc5('0x3c')]({},_0x5a241f,_0x48af05[_0x8fc5('0x3f')]);return _0x1202ac[_0x8fc5('0x4b')](_0x5a241f);}})[_0x8fc5('0x24')](function(_0x39193e){if(_0x39193e){_0x29375c=_0x39193e['length'];if(!_0x48af05[_0x8fc5('0x2f')]['hasOwnProperty'](_0x8fc5('0x36'))){_0x5a241f[_0x8fc5('0x1e')]=qs[_0x8fc5('0x1e')](_0x48af05['query'][_0x8fc5('0x1e')]);_0x5a241f[_0x8fc5('0x1c')]=qs[_0x8fc5('0x1c')](_0x48af05['query'][_0x8fc5('0x1c')]);}return _0x1202ac[_0x8fc5('0x4b')](_0x5a241f);}})[_0x8fc5('0x24')](function(_0x1a5218){if(_0x1a5218){return _0x1a5218?{'count':_0x29375c,'rows':_0x1a5218}:null;}})[_0x8fc5('0x24')](respondWithResult(_0xa834dd,null))[_0x8fc5('0x44')](handleError(_0xa834dd,null));};exports[_0x8fc5('0x4e')]=function(_0x50aad5,_0xca28ed,_0x4ec229){if(_0x50aad5[_0x8fc5('0x49')]['id']){delete _0x50aad5[_0x8fc5('0x49')]['id'];}return db[_0x8fc5('0x2a')][_0x8fc5('0x4c')]({'where':{'id':_0x50aad5['params']['id']}})[_0x8fc5('0x24')](handleEntityNotFound(_0xca28ed,null))['then'](function(_0xcbf213){if(_0xcbf213){_0x50aad5[_0x8fc5('0x49')][_0x8fc5('0x4f')]=_0xcbf213['id'];_0x50aad5['body']['Subjects']=integrations[_0x8fc5('0x50')](_0x50aad5[_0x8fc5('0x49')][_0x8fc5('0x51')],_0x50aad5[_0x8fc5('0x49')][_0x8fc5('0x3e')]);_0x50aad5['body'][_0x8fc5('0x52')]=integrations[_0x8fc5('0x53')](_0x50aad5[_0x8fc5('0x49')][_0x8fc5('0x51')],_0x50aad5[_0x8fc5('0x49')][_0x8fc5('0x3e')]);return db[_0x8fc5('0x4d')][_0x8fc5('0x48')](_0x50aad5[_0x8fc5('0x49')],{'include':[{'model':db[_0x8fc5('0x54')],'as':_0x8fc5('0x55')},{'model':db[_0x8fc5('0x54')],'as':_0x8fc5('0x52')}]});}return null;})[_0x8fc5('0x24')](respondWithResult(_0xca28ed,null))['catch'](handleError(_0xca28ed,null));};exports['getFields']=function(_0x371e98,_0x37189f,_0x5adcf5){var _0x1657b2=[_0x8fc5('0x56'),_0x8fc5('0x57'),'knowledge',_0x8fc5('0x58'),_0x8fc5('0x59'),'notify','incident_state',_0x8fc5('0x5a'),_0x8fc5('0x5b')];var _0x11e258=[_0x8fc5('0x5c'),_0x8fc5('0x56'),'caused_by','watch_list',_0x8fc5('0x5d'),_0x8fc5('0x5e'),_0x8fc5('0x5f'),'hold_reason',_0x8fc5('0x60'),_0x8fc5('0x61'),_0x8fc5('0x62'),'sys_updated_by',_0x8fc5('0x63'),'user_input',_0x8fc5('0x64'),_0x8fc5('0x65'),_0x8fc5('0x66'),_0x8fc5('0x67'),'knowledge','order',_0x8fc5('0x68'),'closed_at',_0x8fc5('0x69'),_0x8fc5('0x6a'),_0x8fc5('0x6b'),_0x8fc5('0x6c'),_0x8fc5('0x6d'),'business_service',_0x8fc5('0x6e'),'sys_domain_path',_0x8fc5('0x6f'),_0x8fc5('0x70'),_0x8fc5('0x71'),_0x8fc5('0x72'),_0x8fc5('0x73'),_0x8fc5('0x74'),_0x8fc5('0x75'),_0x8fc5('0x76'),_0x8fc5('0x77'),_0x8fc5('0x78'),'approval_set',_0x8fc5('0x58'),_0x8fc5('0x79'),'short_description',_0x8fc5('0x59'),_0x8fc5('0x7a'),'delivery_task',_0x8fc5('0x7b'),_0x8fc5('0x7c'),_0x8fc5('0x7d'),'additional_assignee_list',_0x8fc5('0x7e'),'calendar_duration',_0x8fc5('0x7f'),_0x8fc5('0x80'),_0x8fc5('0x81'),'closed_by','follow_up',_0x8fc5('0x82'),'sys_id','contact_type',_0x8fc5('0x83'),_0x8fc5('0x84'),_0x8fc5('0x85'),_0x8fc5('0x86'),_0x8fc5('0x87'),_0x8fc5('0x88'),_0x8fc5('0x89'),_0x8fc5('0x8a'),_0x8fc5('0x5a'),'comments',_0x8fc5('0x8b'),'approval','comments_and_work_notes',_0x8fc5('0x8c'),_0x8fc5('0x8d'),_0x8fc5('0x8e'),_0x8fc5('0x8f'),_0x8fc5('0x90'),_0x8fc5('0x91'),_0x8fc5('0x92'),_0x8fc5('0x93'),_0x8fc5('0x5b')];var _0x228c14='';var _0x1c273c='';var _0x19d0da=[];var _0x3e3eef='';var _0x4e5b5b='';var _0x37f633=[];var _0x2f0ba4='';var _0x3a7ca0='';var _0x56785d={};var _0x2d17da='';return db[_0x8fc5('0x2a')]['findOne']({'where':{'id':_0x371e98[_0x8fc5('0x46')]['id']},'attributes':['id',_0x8fc5('0x94'),'password',_0x8fc5('0x95'),_0x8fc5('0x96'),_0x8fc5('0x97')]})[_0x8fc5('0x24')](handleEntityNotFound(_0x37189f,null))[_0x8fc5('0x24')](function(_0x351158){if(_0x351158){_0x2d17da=_0x351158[_0x8fc5('0x96')];var _0x53b96c=_0x2d17da['slice'](-0x1);if(_0x53b96c==='/'){_0x2d17da=_0x2d17da[_0x8fc5('0x98')](0x0,_0x2d17da[_0x8fc5('0x99')](_0x53b96c));}_0x3a7ca0=util[_0x8fc5('0x9a')]('%s/api/now/doc/table/schema/',_0x2d17da);_0x2f0ba4=util[_0x8fc5('0x9a')](_0x8fc5('0x9b'),_0x2d17da);_0x56785d={'user':_0x351158[_0x8fc5('0x94')],'pass':_0x351158['password']};var _0x3ba7cf={'method':_0x8fc5('0x9c'),'uri':_0x3a7ca0+_0x8fc5('0x9d'),'auth':_0x56785d,'json':!![]};return rp(_0x3ba7cf);}})[_0x8fc5('0x24')](function(_0x383e73){if(_0x383e73[_0x8fc5('0x9e')][_0x8fc5('0x47')]>0x0){_0x228c14=_0x383e73[_0x8fc5('0x9e')];}console['log']('incident\x20table\x20objects',_0x228c14);_0x37f633=[];_0x1c273c=Object[_0x8fc5('0x9f')]([],_0x228c14);_['remove'](_0x1c273c,function(_0xe62b40){return!_0x1657b2[_0x8fc5('0xa0')](_0xe62b40[_0x8fc5('0x28')]);});_0x1c273c[_0x8fc5('0xa1')](function(_0x3ee0e8){var _0x2ebf10=createFieldObject(_0x2f0ba4,_0x56785d,_0x3ee0e8['internalType'],_0x3ee0e8[_0x8fc5('0x28')],_0x3ee0e8[_0x8fc5('0xa2')],![]);_0x37f633[_0x8fc5('0xa3')](_0x2ebf10);});return Promise[_0x8fc5('0xa4')](_0x37f633);})['then'](function(_0x5b6593){_0x19d0da=_0x5b6593;_0x3e3eef=Object[_0x8fc5('0x9f')]([],_0x228c14);console[_0x8fc5('0xa5')]('TCL:\x20_object',_0x228c14);_['remove'](_0x3e3eef,function(_0x51598b){return _0x11e258[_0x8fc5('0xa0')](_0x51598b['name']);});console[_0x8fc5('0xa5')](_0x8fc5('0xa6'),_0x3e3eef);_0x37f633=[];_0x3e3eef[_0x8fc5('0xa1')](function(_0x5e32db){var _0x5683d7=createFieldObject(_0x2f0ba4,_0x56785d,_0x5e32db['internalType'],_0x5e32db['name'],_0x5e32db[_0x8fc5('0xa2')],!![]);_0x37f633[_0x8fc5('0xa3')](_0x5683d7);});return Promise[_0x8fc5('0xa4')](_0x37f633);})[_0x8fc5('0x24')](function(_0x1a355f){_0x4e5b5b=_0x1a355f;var _0x7cc71c=_0x19d0da['concat'](_0x4e5b5b);return{'count':_0x7cc71c[_0x8fc5('0x47')],'rows':_0x7cc71c};})[_0x8fc5('0x24')](respondWithResult(_0x37189f,null))[_0x8fc5('0x44')](function(_0x51c0e4){console['log']('ServiceNow\x20error:\x20'+_0x51c0e4);var _0xf8e9ce=_0x371e98[_0x8fc5('0x2f')][_0x8fc5('0xa7')]?0x1f4:_0x51c0e4[_0x8fc5('0xa8')]||0x1f4;logger[_0x8fc5('0x26')](_0x51c0e4[_0x8fc5('0x27')]);delete _0x51c0e4[_0x8fc5('0x28')];if(_0xf8e9ce===0x191){_0xf8e9ce=0x190;}_0x37189f[_0x8fc5('0x19')](_0xf8e9ce)[_0x8fc5('0x29')](_0x371e98[_0x8fc5('0x2f')][_0x8fc5('0xa7')]?{'message':'Wrong\x20credentials','statusCode':_0x51c0e4[_0x8fc5('0xa8')]}:_0x51c0e4);});};function createFieldObject(_0x28b4f7,_0x1fd959,_0xc1f30d,_0x3da690,_0x3a9e5c,_0x57c8de){return new Promise(function(_0x288b4d,_0x5bd684){var _0x5e8aa0={'id':_0x3da690,'name':_0x3a9e5c,'custom':_0x57c8de};if(_0xc1f30d===_0x8fc5('0xa9')){_0x5e8aa0['options']=[{'name':_0x8fc5('0xaa'),'value':'true'},{'name':_0x8fc5('0xab'),'value':_0x8fc5('0xac')}];_0x288b4d(_0x5e8aa0);}else{var _0x3c202d={'method':_0x8fc5('0x9c'),'uri':_0x28b4f7+_0x8fc5('0xad')+_0x3da690,'auth':_0x1fd959,'json':!![]};return rp(_0x3c202d)[_0x8fc5('0x24')](function(_0x42e4d7){var _0x96d0de=[];if(_0x42e4d7['result'][_0x8fc5('0x47')]>0x0){_0x42e4d7[_0x8fc5('0x9e')][_0x8fc5('0xa1')](function(_0x1cc50e){if(_0x1cc50e[_0x8fc5('0xae')]===_0x8fc5('0xac')){var _0x585c0f={'name':_0x1cc50e[_0x8fc5('0xa2')],'value':_0x1cc50e['value']};_0x96d0de[_0x8fc5('0xa3')](_0x585c0f);}});}_0x5e8aa0['options']=_0x96d0de;if(_0x5e8aa0['options'][_0x8fc5('0x47')]>0x0){_0x288b4d(_0x5e8aa0);}else{if(_0x57c8de==![]){_0x288b4d();}else{_0x288b4d(_0x5e8aa0);}}});}});}