cf44f02d253a8fb443b7b6bbfdb33874e7aad7d9
[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 _0x9f40=['sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','fields','create','body','find','findOne','ServicenowConfiguration','pick','getConfigurations','addConfiguration','AccountId','Descriptions','getDescriptions','channel','ServicenowField','Subjects','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','resolved_by','sys_updated_by','sys_created_on','state','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','reopened_time','resolved_at','caller_id','approval_set','short_description','delivery_task','assignment_group','additional_assignee_list','description','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','correlation_id','location','username','password','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','internalType','label','TCL:\x20_object','push','all','concat','ServiceNow\x20error:\x20','test','statusCode','true','False','false','inactive','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','update','then','destroy','error','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x206bd1,_0x45237e){var _0x27df15=function(_0x35b1d2){while(--_0x35b1d2){_0x206bd1['push'](_0x206bd1['shift']());}};_0x27df15(++_0x45237e);}(_0x9f40,0x1e2));var _0x09f4=function(_0x58030d,_0x28ba40){_0x58030d=_0x58030d-0x0;var _0x3c9cf=_0x9f40[_0x58030d];return _0x3c9cf;};'use strict';var emlformat=require(_0x09f4('0x0'));var rimraf=require(_0x09f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x09f4('0x2'));var rp=require(_0x09f4('0x3'));var moment=require(_0x09f4('0x4'));var BPromise=require(_0x09f4('0x5'));var Mustache=require('mustache');var util=require(_0x09f4('0x6'));var path=require(_0x09f4('0x7'));var sox=require(_0x09f4('0x8'));var csv=require(_0x09f4('0x9'));var ejs=require(_0x09f4('0xa'));var fs=require('fs');var fs_extra=require(_0x09f4('0xb'));var _=require(_0x09f4('0xc'));var squel=require('squel');var crypto=require(_0x09f4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x09f4('0xe'));var toCsv=require(_0x09f4('0x9'));var querystring=require('querystring');var Papa=require(_0x09f4('0xf'));var Redis=require(_0x09f4('0x10'));var authService=require(_0x09f4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x09f4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x09f4('0x13'))('api');var utils=require(_0x09f4('0x14'));var config=require(_0x09f4('0x15'));var licenseUtil=require(_0x09f4('0x16'));var db=require(_0x09f4('0x17'))['db'];var integrations=require(_0x09f4('0x18'));function respondWithStatusCode(_0x43eaf0,_0x77e658){_0x77e658=_0x77e658||0xcc;return function(_0x44bf71){if(_0x44bf71){return _0x43eaf0[_0x09f4('0x19')](_0x77e658);}return _0x43eaf0[_0x09f4('0x1a')](_0x77e658)[_0x09f4('0x1b')]();};}function respondWithResult(_0x21129c,_0x2e0dc1){_0x2e0dc1=_0x2e0dc1||0xc8;return function(_0x41c72e){if(_0x41c72e){return _0x21129c[_0x09f4('0x1a')](_0x2e0dc1)['json'](_0x41c72e);}};}function respondWithFilteredResult(_0x176a94,_0x537489){return function(_0xa55b90){if(_0xa55b90){var _0x44daea=typeof _0x537489[_0x09f4('0x1c')]==='undefined'&&typeof _0x537489['limit']===_0x09f4('0x1d');var _0x4990b2=_0xa55b90[_0x09f4('0x1e')];var _0x303dbc=_0x44daea?0x0:_0x537489['offset'];var _0xde3717=_0x44daea?_0xa55b90[_0x09f4('0x1e')]:_0x537489[_0x09f4('0x1c')]+_0x537489[_0x09f4('0x1f')];var _0x577bed;if(_0xde3717>=_0x4990b2){_0xde3717=_0x4990b2;_0x577bed=0xc8;}else{_0x577bed=0xce;}_0x176a94['status'](_0x577bed);return _0x176a94[_0x09f4('0x20')](_0x09f4('0x21'),_0x303dbc+'-'+_0xde3717+'/'+_0x4990b2)[_0x09f4('0x22')](_0xa55b90);}return null;};}function patchUpdates(_0x268c4b){return function(_0x20f503){try{jsonpatch[_0x09f4('0x23')](_0x20f503,_0x268c4b,!![]);}catch(_0x151126){return BPromise['reject'](_0x151126);}return _0x20f503['save']();};}function saveUpdates(_0x21b3b7,_0x3bdba1){return function(_0x4161ca){if(_0x4161ca){return _0x4161ca[_0x09f4('0x24')](_0x21b3b7)[_0x09f4('0x25')](function(_0x51eaf5){return _0x51eaf5;});}return null;};}function removeEntity(_0x495419,_0xca3ef9){return function(_0x565a6d){if(_0x565a6d){return _0x565a6d[_0x09f4('0x26')]()['then'](function(){_0x495419[_0x09f4('0x1a')](0xcc)[_0x09f4('0x1b')]();});}};}function handleEntityNotFound(_0x136af9,_0xbbe2d){return function(_0x4d4b03){if(!_0x4d4b03){_0x136af9[_0x09f4('0x19')](0x194);}return _0x4d4b03;};}function handleError(_0x53c3b2,_0x27f98e){_0x27f98e=_0x27f98e||0x1f4;return function(_0x1e1a7c){logger[_0x09f4('0x27')](_0x1e1a7c[_0x09f4('0x28')]);if(_0x1e1a7c[_0x09f4('0x29')]){delete _0x1e1a7c['name'];}_0x53c3b2[_0x09f4('0x1a')](_0x27f98e)[_0x09f4('0x2a')](_0x1e1a7c);};}exports['index']=function(_0x623a97,_0x2453a9){var _0xbcbdb4={},_0x5a1d97={},_0xc47926={'count':0x0,'rows':[]};var _0x3bdf76=_[_0x09f4('0x2b')](db[_0x09f4('0x2c')][_0x09f4('0x2d')],function(_0x115947){return{'name':_0x115947[_0x09f4('0x2e')],'type':_0x115947[_0x09f4('0x2f')][_0x09f4('0x30')]};});_0x5a1d97['model']=_['map'](_0x3bdf76,_0x09f4('0x29'));_0x5a1d97[_0x09f4('0x31')]=_['keys'](_0x623a97[_0x09f4('0x31')]);_0x5a1d97[_0x09f4('0x32')]=_[_0x09f4('0x33')](_0x5a1d97[_0x09f4('0x34')],_0x5a1d97[_0x09f4('0x31')]);_0xbcbdb4[_0x09f4('0x35')]=_[_0x09f4('0x33')](_0x5a1d97[_0x09f4('0x34')],qs['fields'](_0x623a97['query']['fields']));_0xbcbdb4[_0x09f4('0x35')]=_0xbcbdb4[_0x09f4('0x35')][_0x09f4('0x36')]?_0xbcbdb4[_0x09f4('0x35')]:_0x5a1d97[_0x09f4('0x34')];if(!_0x623a97['query'][_0x09f4('0x37')](_0x09f4('0x38'))){_0xbcbdb4[_0x09f4('0x1f')]=qs[_0x09f4('0x1f')](_0x623a97[_0x09f4('0x31')][_0x09f4('0x1f')]);_0xbcbdb4[_0x09f4('0x1c')]=qs[_0x09f4('0x1c')](_0x623a97[_0x09f4('0x31')][_0x09f4('0x1c')]);}_0xbcbdb4[_0x09f4('0x39')]=qs['sort'](_0x623a97[_0x09f4('0x31')][_0x09f4('0x3a')]);_0xbcbdb4[_0x09f4('0x3b')]=qs[_0x09f4('0x32')](_['pick'](_0x623a97[_0x09f4('0x31')],_0x5a1d97['filters']),_0x3bdf76);if(_0x623a97[_0x09f4('0x31')]['filter']){_0xbcbdb4[_0x09f4('0x3b')]=_[_0x09f4('0x3c')](_0xbcbdb4[_0x09f4('0x3b')],{'$or':_[_0x09f4('0x2b')](_0x3bdf76,function(_0x1314e8){if(_0x1314e8[_0x09f4('0x2f')]!==_0x09f4('0x3d')){var _0x4a260a={};_0x4a260a[_0x1314e8[_0x09f4('0x29')]]={'$like':'%'+_0x623a97[_0x09f4('0x31')][_0x09f4('0x3e')]+'%'};return _0x4a260a;}})});}_0xbcbdb4=_[_0x09f4('0x3c')]({},_0xbcbdb4,_0x623a97[_0x09f4('0x3f')]);var _0x51416e={'where':_0xbcbdb4[_0x09f4('0x3b')]};return db[_0x09f4('0x2c')][_0x09f4('0x1e')](_0x51416e)[_0x09f4('0x25')](function(_0x495888){_0xc47926[_0x09f4('0x1e')]=_0x495888;if(_0x623a97['query'][_0x09f4('0x40')]){_0xbcbdb4[_0x09f4('0x41')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x09f4('0x42')](_0xbcbdb4);})[_0x09f4('0x25')](function(_0x2f4887){_0xc47926['rows']=_0x2f4887;return _0xc47926;})['then'](respondWithFilteredResult(_0x2453a9,_0xbcbdb4))[_0x09f4('0x43')](handleError(_0x2453a9,null));};exports[_0x09f4('0x44')]=function(_0xfc08db,_0x3a171d){var _0x721462={'raw':![],'where':{'id':_0xfc08db[_0x09f4('0x45')]['id']}},_0x53c445={};_0x53c445[_0x09f4('0x34')]=_[_0x09f4('0x46')](db[_0x09f4('0x2c')]['rawAttributes']);_0x53c445[_0x09f4('0x31')]=_[_0x09f4('0x46')](_0xfc08db[_0x09f4('0x31')]);_0x53c445[_0x09f4('0x32')]=_[_0x09f4('0x33')](_0x53c445[_0x09f4('0x34')],_0x53c445[_0x09f4('0x31')]);_0x721462['attributes']=_[_0x09f4('0x33')](_0x53c445[_0x09f4('0x34')],qs[_0x09f4('0x47')](_0xfc08db['query'][_0x09f4('0x47')]));_0x721462[_0x09f4('0x35')]=_0x721462['attributes'][_0x09f4('0x36')]?_0x721462['attributes']:_0x53c445[_0x09f4('0x34')];if(_0xfc08db[_0x09f4('0x31')]['includeAll']){_0x721462['include']=[{'all':!![]}];}_0x721462=_[_0x09f4('0x3c')]({},_0x721462,_0xfc08db[_0x09f4('0x3f')]);return db[_0x09f4('0x2c')]['find'](_0x721462)[_0x09f4('0x25')](handleEntityNotFound(_0x3a171d,null))[_0x09f4('0x25')](respondWithResult(_0x3a171d,null))[_0x09f4('0x43')](handleError(_0x3a171d,null));};exports['create']=function(_0x5ef650,_0x5d33cc){return db['ServicenowAccount'][_0x09f4('0x48')](_0x5ef650[_0x09f4('0x49')],{})[_0x09f4('0x25')](respondWithResult(_0x5d33cc,0xc9))['catch'](handleError(_0x5d33cc,null));};exports[_0x09f4('0x24')]=function(_0x1e47f0,_0x45959a){if(_0x1e47f0[_0x09f4('0x49')]['id']){delete _0x1e47f0[_0x09f4('0x49')]['id'];}return db[_0x09f4('0x2c')][_0x09f4('0x4a')]({'where':{'id':_0x1e47f0['params']['id']}})[_0x09f4('0x25')](handleEntityNotFound(_0x45959a,null))['then'](saveUpdates(_0x1e47f0['body'],null))[_0x09f4('0x25')](respondWithResult(_0x45959a,null))[_0x09f4('0x43')](handleError(_0x45959a,null));};exports['destroy']=function(_0x3d86dc,_0x117a84){return db['ServicenowAccount'][_0x09f4('0x4a')]({'where':{'id':_0x3d86dc[_0x09f4('0x45')]['id']}})['then'](handleEntityNotFound(_0x117a84,null))['then'](removeEntity(_0x117a84,null))[_0x09f4('0x43')](handleError(_0x117a84,null));};exports['getConfigurations']=function(_0x3ba51c,_0x2b7319,_0x3f4d24){var _0x3d6e39={};var _0x554592={};var _0x4763bf;var _0x4b277f;return db[_0x09f4('0x2c')][_0x09f4('0x4b')]({'where':{'id':_0x3ba51c[_0x09f4('0x45')]['id']}})[_0x09f4('0x25')](handleEntityNotFound(_0x2b7319,null))[_0x09f4('0x25')](function(_0x57eb75){if(_0x57eb75){_0x4763bf=_0x57eb75;_0x554592['model']=_['keys'](db[_0x09f4('0x4c')][_0x09f4('0x2d')]);_0x554592[_0x09f4('0x31')]=_['keys'](_0x3ba51c[_0x09f4('0x31')]);_0x554592[_0x09f4('0x32')]=_['intersection'](_0x554592[_0x09f4('0x34')],_0x554592[_0x09f4('0x31')]);_0x3d6e39['attributes']=_[_0x09f4('0x33')](_0x554592['model'],qs[_0x09f4('0x47')](_0x3ba51c[_0x09f4('0x31')][_0x09f4('0x47')]));_0x3d6e39[_0x09f4('0x35')]=_0x3d6e39[_0x09f4('0x35')]['length']?_0x3d6e39['attributes']:_0x554592[_0x09f4('0x34')];_0x3d6e39['order']=qs[_0x09f4('0x3a')](_0x3ba51c[_0x09f4('0x31')][_0x09f4('0x3a')]);_0x3d6e39[_0x09f4('0x3b')]=qs[_0x09f4('0x32')](_[_0x09f4('0x4d')](_0x3ba51c[_0x09f4('0x31')],_0x554592[_0x09f4('0x32')]));if(_0x3ba51c[_0x09f4('0x31')][_0x09f4('0x3e')]){_0x3d6e39[_0x09f4('0x3b')]=_[_0x09f4('0x3c')](_0x3d6e39[_0x09f4('0x3b')],{'$or':_[_0x09f4('0x2b')](_0x3d6e39['attributes'],function(_0x52da97){var _0x338d35={};_0x338d35[_0x52da97]={'$like':'%'+_0x3ba51c[_0x09f4('0x31')][_0x09f4('0x3e')]+'%'};return _0x338d35;})});}_0x3d6e39=_[_0x09f4('0x3c')]({},_0x3d6e39,_0x3ba51c['options']);return _0x4763bf[_0x09f4('0x4e')](_0x3d6e39);}})['then'](function(_0x211d80){if(_0x211d80){_0x4b277f=_0x211d80['length'];if(!_0x3ba51c[_0x09f4('0x31')]['hasOwnProperty'](_0x09f4('0x38'))){_0x3d6e39[_0x09f4('0x1f')]=qs['limit'](_0x3ba51c['query'][_0x09f4('0x1f')]);_0x3d6e39[_0x09f4('0x1c')]=qs[_0x09f4('0x1c')](_0x3ba51c[_0x09f4('0x31')][_0x09f4('0x1c')]);}return _0x4763bf['getConfigurations'](_0x3d6e39);}})[_0x09f4('0x25')](function(_0x5b10e5){if(_0x5b10e5){return _0x5b10e5?{'count':_0x4b277f,'rows':_0x5b10e5}:null;}})[_0x09f4('0x25')](respondWithResult(_0x2b7319,null))['catch'](handleError(_0x2b7319,null));};exports[_0x09f4('0x4f')]=function(_0x2ed251,_0x2b77a7,_0x16343a){if(_0x2ed251['body']['id']){delete _0x2ed251[_0x09f4('0x49')]['id'];}return db['ServicenowAccount'][_0x09f4('0x4b')]({'where':{'id':_0x2ed251[_0x09f4('0x45')]['id']}})[_0x09f4('0x25')](handleEntityNotFound(_0x2b77a7,null))[_0x09f4('0x25')](function(_0x4e1628){if(_0x4e1628){_0x2ed251[_0x09f4('0x49')][_0x09f4('0x50')]=_0x4e1628['id'];_0x2ed251[_0x09f4('0x49')]['Subjects']=integrations['getSubjects'](_0x2ed251[_0x09f4('0x49')]['channel'],_0x2ed251['body'][_0x09f4('0x2f')]);_0x2ed251[_0x09f4('0x49')][_0x09f4('0x51')]=integrations[_0x09f4('0x52')](_0x2ed251[_0x09f4('0x49')][_0x09f4('0x53')],_0x2ed251[_0x09f4('0x49')]['type']);return db[_0x09f4('0x4c')][_0x09f4('0x48')](_0x2ed251[_0x09f4('0x49')],{'include':[{'model':db[_0x09f4('0x54')],'as':_0x09f4('0x55')},{'model':db[_0x09f4('0x54')],'as':_0x09f4('0x51')}]});}return null;})[_0x09f4('0x25')](respondWithResult(_0x2b77a7,null))[_0x09f4('0x43')](handleError(_0x2b77a7,null));};exports[_0x09f4('0x56')]=function(_0x5bd02f,_0x31d71a,_0x2b9c54){var _0x211c35=[_0x09f4('0x57'),_0x09f4('0x58'),_0x09f4('0x59'),_0x09f4('0x5a'),_0x09f4('0x5b'),_0x09f4('0x5c'),_0x09f4('0x5d'),_0x09f4('0x5e'),_0x09f4('0x5f')];var _0x402e6b=[_0x09f4('0x60'),_0x09f4('0x57'),_0x09f4('0x61'),_0x09f4('0x62'),_0x09f4('0x63'),_0x09f4('0x64'),_0x09f4('0x65'),_0x09f4('0x58'),'approval_history','number',_0x09f4('0x66'),_0x09f4('0x67'),'opened_by','user_input',_0x09f4('0x68'),'sys_domain',_0x09f4('0x69'),'sys_created_by',_0x09f4('0x59'),_0x09f4('0x39'),'calendar_stc',_0x09f4('0x6a'),_0x09f4('0x6b'),_0x09f4('0x6c'),_0x09f4('0x6d'),_0x09f4('0x6e'),_0x09f4('0x6f'),'business_service',_0x09f4('0x70'),_0x09f4('0x71'),_0x09f4('0x72'),_0x09f4('0x73'),_0x09f4('0x74'),_0x09f4('0x75'),_0x09f4('0x76'),'group_list','work_end',_0x09f4('0x77'),_0x09f4('0x78'),_0x09f4('0x79'),_0x09f4('0x7a'),'subcategory','work_notes',_0x09f4('0x7b'),_0x09f4('0x5b'),'correlation_display',_0x09f4('0x7c'),'work_start',_0x09f4('0x7d'),'business_stc',_0x09f4('0x7e'),_0x09f4('0x7f'),'calendar_duration','notify',_0x09f4('0x80'),_0x09f4('0x81'),_0x09f4('0x82'),_0x09f4('0x83'),_0x09f4('0x84'),_0x09f4('0x85'),_0x09f4('0x86'),'reopened_by',_0x09f4('0x5d'),_0x09f4('0x87'),_0x09f4('0x88'),_0x09f4('0x89'),_0x09f4('0x8a'),_0x09f4('0x8b'),'assigned_to',_0x09f4('0x5e'),_0x09f4('0x8c'),_0x09f4('0x8d'),_0x09f4('0x8e'),_0x09f4('0x8f'),_0x09f4('0x90'),_0x09f4('0x91'),_0x09f4('0x92'),'sys_tags',_0x09f4('0x93'),'upon_approval',_0x09f4('0x94'),_0x09f4('0x95'),_0x09f4('0x5f')];var _0x2f74d2='';var _0x3b47cd='';var _0x575016=[];var _0x4184ca='';var _0x21c60f='';var _0x187836=[];var _0x354b08='';var _0x400550='';var _0x15d6c6={};var _0x310a17='';return db['ServicenowAccount'][_0x09f4('0x4b')]({'where':{'id':_0x5bd02f[_0x09f4('0x45')]['id']},'attributes':['id',_0x09f4('0x96'),_0x09f4('0x97'),'email','remoteUri',_0x09f4('0x98')]})[_0x09f4('0x25')](handleEntityNotFound(_0x31d71a,null))[_0x09f4('0x25')](function(_0x578443){if(_0x578443){_0x310a17=_0x578443['remoteUri'];var _0x88eb3f=_0x310a17[_0x09f4('0x99')](-0x1);if(_0x88eb3f==='/'){_0x310a17=_0x310a17[_0x09f4('0x9a')](0x0,_0x310a17[_0x09f4('0x9b')](_0x88eb3f));}_0x400550=util[_0x09f4('0x9c')](_0x09f4('0x9d'),_0x310a17);_0x354b08=util['format'](_0x09f4('0x9e'),_0x310a17);_0x15d6c6={'user':_0x578443[_0x09f4('0x96')],'pass':_0x578443[_0x09f4('0x97')]};var _0x3a3b47={'method':_0x09f4('0x9f'),'uri':_0x400550+_0x09f4('0xa0'),'auth':_0x15d6c6,'json':!![]};return rp(_0x3a3b47);}})['then'](function(_0x271dfd){if(_0x271dfd[_0x09f4('0xa1')][_0x09f4('0x36')]>0x0){_0x2f74d2=_0x271dfd[_0x09f4('0xa1')];}console[_0x09f4('0xa2')](_0x09f4('0xa3'),_0x2f74d2);_0x187836=[];_0x3b47cd=Object[_0x09f4('0xa4')]([],_0x2f74d2);_[_0x09f4('0xa5')](_0x3b47cd,function(_0x5ce61b){return!_0x211c35[_0x09f4('0xa6')](_0x5ce61b['name']);});_0x3b47cd['forEach'](function(_0xeb0fdd){var _0x56914e=createFieldObject(_0x354b08,_0x15d6c6,_0xeb0fdd[_0x09f4('0xa7')],_0xeb0fdd[_0x09f4('0x29')],_0xeb0fdd[_0x09f4('0xa8')],![]);_0x187836['push'](_0x56914e);});return Promise['all'](_0x187836);})[_0x09f4('0x25')](function(_0x24ec47){_0x575016=_0x24ec47;_0x4184ca=Object['assign']([],_0x2f74d2);console['log'](_0x09f4('0xa9'),_0x2f74d2);_[_0x09f4('0xa5')](_0x4184ca,function(_0x456538){return _0x402e6b['includes'](_0x456538[_0x09f4('0x29')]);});console[_0x09f4('0xa2')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x4184ca);_0x187836=[];_0x4184ca['forEach'](function(_0x46929a){var _0x371d18=createFieldObject(_0x354b08,_0x15d6c6,_0x46929a[_0x09f4('0xa7')],_0x46929a['name'],_0x46929a[_0x09f4('0xa8')],!![]);_0x187836[_0x09f4('0xaa')](_0x371d18);});return Promise[_0x09f4('0xab')](_0x187836);})[_0x09f4('0x25')](function(_0x398b44){_0x21c60f=_0x398b44;var _0x4f722e=_0x575016[_0x09f4('0xac')](_0x21c60f);return{'count':_0x4f722e[_0x09f4('0x36')],'rows':_0x4f722e};})[_0x09f4('0x25')](respondWithResult(_0x31d71a,null))[_0x09f4('0x43')](function(_0x354162){console['log'](_0x09f4('0xad')+_0x354162);var _0x11f778=_0x5bd02f['query'][_0x09f4('0xae')]?0x1f4:_0x354162[_0x09f4('0xaf')]||0x1f4;logger[_0x09f4('0x27')](_0x354162[_0x09f4('0x28')]);delete _0x354162[_0x09f4('0x29')];if(_0x11f778===0x191){_0x11f778=0x190;}_0x31d71a[_0x09f4('0x1a')](_0x11f778)[_0x09f4('0x2a')](_0x5bd02f['query'][_0x09f4('0xae')]?{'message':'Wrong\x20credentials','statusCode':_0x354162[_0x09f4('0xaf')]}:_0x354162);});};function createFieldObject(_0xa2e02c,_0x390743,_0x4b2c82,_0x161f3b,_0x316082,_0x5a2e8d){return new Promise(function(_0x26d51e,_0x1038d0){var _0x109cb2={'id':_0x161f3b,'name':_0x316082,'custom':_0x5a2e8d};if(_0x4b2c82==='boolean'){_0x109cb2[_0x09f4('0x3f')]=[{'name':'True','value':_0x09f4('0xb0')},{'name':_0x09f4('0xb1'),'value':_0x09f4('0xb2')}];_0x26d51e(_0x109cb2);}else{var _0xfeaabc={'method':_0x09f4('0x9f'),'uri':_0xa2e02c+'sys_choice?sysparm_query=name=incident^element='+_0x161f3b,'auth':_0x390743,'json':!![]};return rp(_0xfeaabc)[_0x09f4('0x25')](function(_0x2cdc42){var _0x38a2cc=[];if(_0x2cdc42[_0x09f4('0xa1')][_0x09f4('0x36')]>0x0){_0x2cdc42[_0x09f4('0xa1')]['forEach'](function(_0x23e614){if(_0x23e614[_0x09f4('0xb3')]===_0x09f4('0xb2')){var _0x32b136={'name':_0x23e614[_0x09f4('0xa8')],'value':_0x23e614['value']};_0x38a2cc[_0x09f4('0xaa')](_0x32b136);}});}_0x109cb2[_0x09f4('0x3f')]=_0x38a2cc;if(_0x109cb2['options'][_0x09f4('0x36')]>0x0){_0x26d51e(_0x109cb2);}else{if(_0x5a2e8d==![]){_0x26d51e();}else{_0x26d51e(_0x109cb2);}}});}});}