Built motion from commit (unavailable).|2.5.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 _0xbff5=['type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','show','params','include','find','create','body','getConfigurations','ServicenowConfiguration','addConfiguration','findOne','Subjects','Descriptions','getDescriptions','ServicenowField','getFields','knowledge','subcategory','close_code','severity','category','made_sla','caused_by','watch_list','upon_reject','hold_reason','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','business_service','priority','sys_domain_path','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','notify','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','activity_due','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','password','remoteUri','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','includes','forEach','label','assign','TCL:\x20_object','internalType','push','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','client','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowAccount,\x20%s,\x20%s','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','map','ServicenowAccount','rawAttributes','fieldName'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbff5,0x86));var _0x5bff=function(_0x290440,_0x5a139d){_0x290440=_0x290440-0x0;var _0x52d33e=_0xbff5[_0x290440];return _0x52d33e;};'use strict';var emlformat=require(_0x5bff('0x0'));var rimraf=require(_0x5bff('0x1'));var zipdir=require(_0x5bff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5bff('0x3'));var moment=require(_0x5bff('0x4'));var BPromise=require(_0x5bff('0x5'));var Mustache=require('mustache');var util=require(_0x5bff('0x6'));var path=require(_0x5bff('0x7'));var sox=require(_0x5bff('0x8'));var csv=require(_0x5bff('0x9'));var ejs=require(_0x5bff('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5bff('0xb'));var squel=require(_0x5bff('0xc'));var crypto=require(_0x5bff('0xd'));var jsforce=require(_0x5bff('0xe'));var deskjs=require(_0x5bff('0xf'));var toCsv=require(_0x5bff('0x9'));var querystring=require('querystring');var Papa=require(_0x5bff('0x10'));var Redis=require(_0x5bff('0x11'));var authService=require(_0x5bff('0x12'));var qs=require(_0x5bff('0x13'));var as=require(_0x5bff('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5bff('0x15'))(_0x5bff('0x16'));var utils=require(_0x5bff('0x17'));var config=require(_0x5bff('0x18'));var licenseUtil=require(_0x5bff('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5bff('0x1a'));var jayson=require('jayson/promise');var client=jayson[_0x5bff('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28e891,_0x288a18,_0x15f029,_0xc61c3f){return new BPromise(function(_0x4fe8a8,_0x1df002){var _0x1d50f5=_0xc61c3f||client;return _0x1d50f5['request'](_0x28e891,_0x15f029)[_0x5bff('0x1c')](function(_0x51ad14){logger[_0x5bff('0x1d')]('ServicenowAccount,\x20%s,\x20%s',_0x288a18,_0x5bff('0x1e'));logger[_0x5bff('0x1f')](_0x5bff('0x20'),_0x288a18,_0x5bff('0x1e'),JSON[_0x5bff('0x21')](_0x51ad14));if(_0x51ad14[_0x5bff('0x22')]){if(_0x51ad14[_0x5bff('0x22')][_0x5bff('0x23')]===0x1f4){logger[_0x5bff('0x22')]('ServicenowAccount,\x20%s,\x20%s',_0x288a18,_0x51ad14[_0x5bff('0x22')][_0x5bff('0x24')]);return _0x1df002(_0x51ad14[_0x5bff('0x22')][_0x5bff('0x24')]);}logger[_0x5bff('0x22')](_0x5bff('0x25'),_0x288a18,_0x51ad14[_0x5bff('0x22')][_0x5bff('0x24')]);return _0x4fe8a8(_0x51ad14[_0x5bff('0x22')][_0x5bff('0x24')]);}else{logger[_0x5bff('0x1d')](_0x5bff('0x25'),_0x288a18,_0x5bff('0x1e'));_0x4fe8a8(_0x51ad14['result']['message']);}})[_0x5bff('0x26')](function(_0x30a4df){logger['error'](_0x5bff('0x25'),_0x288a18,_0x30a4df);_0x1df002(_0x30a4df);});});}function respondWithStatusCode(_0x3b40d8,_0x564138){_0x564138=_0x564138||0xcc;return function(_0xcc07d5){if(_0xcc07d5){return _0x3b40d8[_0x5bff('0x27')](_0x564138);}return _0x3b40d8[_0x5bff('0x28')](_0x564138)[_0x5bff('0x29')]();};}function respondWithResult(_0x17f2ef,_0x50dd92){_0x50dd92=_0x50dd92||0xc8;return function(_0x100ff9){if(_0x100ff9){return _0x17f2ef[_0x5bff('0x28')](_0x50dd92)[_0x5bff('0x2a')](_0x100ff9);}};}function respondWithFilteredResult(_0xafa982,_0x1b9ec3){return function(_0xfb59e2){if(_0xfb59e2){var _0xf148b1=_0xfb59e2['count'],_0x175e42=_0x1b9ec3['offset'],_0x21a705=_0x1b9ec3[_0x5bff('0x2b')]+_0x1b9ec3[_0x5bff('0x2c')],_0x5cb094;if(_0x21a705>=_0xf148b1){_0x21a705=_0xf148b1;_0x5cb094=0xc8;}else{_0x5cb094=0xce;}_0xafa982[_0x5bff('0x28')](_0x5cb094);return _0xafa982[_0x5bff('0x2d')](_0x5bff('0x2e'),_0x175e42+'-'+_0x21a705+'/'+_0xf148b1)[_0x5bff('0x2a')](_0xfb59e2);}return null;};}function patchUpdates(_0xd4cf29){return function(_0x38ebca){try{jsonpatch[_0x5bff('0x2f')](_0x38ebca,_0xd4cf29,!![]);}catch(_0x781ca7){return BPromise[_0x5bff('0x30')](_0x781ca7);}return _0x38ebca[_0x5bff('0x31')]();};}function saveUpdates(_0x4868a0,_0x1b562b){return function(_0x4dd83c){if(_0x4dd83c){return _0x4dd83c[_0x5bff('0x32')](_0x4868a0)[_0x5bff('0x1c')](function(_0x5625eb){return _0x5625eb;});}return null;};}function removeEntity(_0x529643,_0x5c5f0e){return function(_0x197373){if(_0x197373){return _0x197373[_0x5bff('0x33')]()[_0x5bff('0x1c')](function(){_0x529643['status'](0xcc)[_0x5bff('0x29')]();});}};}function handleEntityNotFound(_0x4ea578,_0x3f1973){return function(_0x38fc67){if(!_0x38fc67){_0x4ea578['sendStatus'](0x194);}return _0x38fc67;};}function handleError(_0x11d3ae,_0x1b1373){_0x1b1373=_0x1b1373||0x1f4;return function(_0x7776bc){logger[_0x5bff('0x22')](_0x7776bc[_0x5bff('0x34')]);if(_0x7776bc[_0x5bff('0x35')]){delete _0x7776bc[_0x5bff('0x35')];}_0x11d3ae[_0x5bff('0x28')](_0x1b1373)['send'](_0x7776bc);};}exports['index']=function(_0x1a4970,_0x3df3cb){var _0x15a275={},_0x50a2cb={},_0xc6cf3e={'count':0x0,'rows':[]};var _0x1c2c8e=_[_0x5bff('0x36')](db[_0x5bff('0x37')][_0x5bff('0x38')],function(_0x1a98a3){return{'name':_0x1a98a3[_0x5bff('0x39')],'type':_0x1a98a3[_0x5bff('0x3a')][_0x5bff('0x3b')]};});_0x50a2cb[_0x5bff('0x3c')]=_[_0x5bff('0x36')](_0x1c2c8e,_0x5bff('0x35'));_0x50a2cb[_0x5bff('0x3d')]=_[_0x5bff('0x3e')](_0x1a4970[_0x5bff('0x3d')]);_0x50a2cb['filters']=_[_0x5bff('0x3f')](_0x50a2cb[_0x5bff('0x3c')],_0x50a2cb[_0x5bff('0x3d')]);_0x15a275[_0x5bff('0x40')]=_[_0x5bff('0x3f')](_0x50a2cb[_0x5bff('0x3c')],qs[_0x5bff('0x41')](_0x1a4970[_0x5bff('0x3d')]['fields']));_0x15a275['attributes']=_0x15a275['attributes'][_0x5bff('0x42')]?_0x15a275[_0x5bff('0x40')]:_0x50a2cb[_0x5bff('0x3c')];if(!_0x1a4970[_0x5bff('0x3d')][_0x5bff('0x43')](_0x5bff('0x44'))){_0x15a275[_0x5bff('0x2c')]=qs[_0x5bff('0x2c')](_0x1a4970[_0x5bff('0x3d')][_0x5bff('0x2c')]);_0x15a275['offset']=qs[_0x5bff('0x2b')](_0x1a4970[_0x5bff('0x3d')][_0x5bff('0x2b')]);}_0x15a275[_0x5bff('0x45')]=qs[_0x5bff('0x46')](_0x1a4970[_0x5bff('0x3d')][_0x5bff('0x46')]);_0x15a275[_0x5bff('0x47')]=qs['filters'](_[_0x5bff('0x48')](_0x1a4970['query'],_0x50a2cb[_0x5bff('0x49')]),_0x1c2c8e);if(_0x1a4970[_0x5bff('0x3d')]['filter']){_0x15a275['where']=_[_0x5bff('0x4a')](_0x15a275[_0x5bff('0x47')],{'$or':_[_0x5bff('0x36')](_0x1c2c8e,function(_0x395542){if(_0x395542['type']!==_0x5bff('0x4b')){var _0x39d38c={};_0x39d38c[_0x395542[_0x5bff('0x35')]]={'$like':'%'+_0x1a4970[_0x5bff('0x3d')][_0x5bff('0x4c')]+'%'};return _0x39d38c;}})});}_0x15a275=_[_0x5bff('0x4a')]({},_0x15a275,_0x1a4970[_0x5bff('0x4d')]);var _0x5ebe4f={'where':_0x15a275[_0x5bff('0x47')]};return db['ServicenowAccount']['count'](_0x5ebe4f)[_0x5bff('0x1c')](function(_0x41b0e7){_0xc6cf3e[_0x5bff('0x4e')]=_0x41b0e7;if(_0x1a4970[_0x5bff('0x3d')][_0x5bff('0x4f')]){_0x15a275['include']=[{'all':!![]}];}return db[_0x5bff('0x37')][_0x5bff('0x50')](_0x15a275);})[_0x5bff('0x1c')](function(_0x4e8aa4){_0xc6cf3e[_0x5bff('0x51')]=_0x4e8aa4;return _0xc6cf3e;})[_0x5bff('0x1c')](respondWithFilteredResult(_0x3df3cb,_0x15a275))[_0x5bff('0x26')](handleError(_0x3df3cb,null));};exports[_0x5bff('0x52')]=function(_0x3ad2ed,_0x346e21){var _0x3d1544={'raw':![],'where':{'id':_0x3ad2ed[_0x5bff('0x53')]['id']}},_0x21334f={};_0x21334f['model']=_[_0x5bff('0x3e')](db[_0x5bff('0x37')][_0x5bff('0x38')]);_0x21334f[_0x5bff('0x3d')]=_[_0x5bff('0x3e')](_0x3ad2ed[_0x5bff('0x3d')]);_0x21334f['filters']=_[_0x5bff('0x3f')](_0x21334f[_0x5bff('0x3c')],_0x21334f[_0x5bff('0x3d')]);_0x3d1544[_0x5bff('0x40')]=_[_0x5bff('0x3f')](_0x21334f[_0x5bff('0x3c')],qs['fields'](_0x3ad2ed['query'][_0x5bff('0x41')]));_0x3d1544[_0x5bff('0x40')]=_0x3d1544[_0x5bff('0x40')][_0x5bff('0x42')]?_0x3d1544[_0x5bff('0x40')]:_0x21334f[_0x5bff('0x3c')];if(_0x3ad2ed[_0x5bff('0x3d')]['includeAll']){_0x3d1544[_0x5bff('0x54')]=[{'all':!![]}];}_0x3d1544=_['merge']({},_0x3d1544,_0x3ad2ed[_0x5bff('0x4d')]);return db[_0x5bff('0x37')][_0x5bff('0x55')](_0x3d1544)[_0x5bff('0x1c')](handleEntityNotFound(_0x346e21,null))[_0x5bff('0x1c')](respondWithResult(_0x346e21,null))[_0x5bff('0x26')](handleError(_0x346e21,null));};exports['create']=function(_0xfbc0c8,_0x5135b5){return db['ServicenowAccount'][_0x5bff('0x56')](_0xfbc0c8[_0x5bff('0x57')],{})['then'](respondWithResult(_0x5135b5,0xc9))['catch'](handleError(_0x5135b5,null));};exports['update']=function(_0x31a2a8,_0x5926ed){if(_0x31a2a8[_0x5bff('0x57')]['id']){delete _0x31a2a8[_0x5bff('0x57')]['id'];}return db['ServicenowAccount'][_0x5bff('0x55')]({'where':{'id':_0x31a2a8['params']['id']}})['then'](handleEntityNotFound(_0x5926ed,null))[_0x5bff('0x1c')](saveUpdates(_0x31a2a8['body'],null))[_0x5bff('0x1c')](respondWithResult(_0x5926ed,null))[_0x5bff('0x26')](handleError(_0x5926ed,null));};exports['destroy']=function(_0x2378e9,_0x5a6207){return db[_0x5bff('0x37')][_0x5bff('0x55')]({'where':{'id':_0x2378e9[_0x5bff('0x53')]['id']}})['then'](handleEntityNotFound(_0x5a6207,null))[_0x5bff('0x1c')](removeEntity(_0x5a6207,null))[_0x5bff('0x26')](handleError(_0x5a6207,null));};exports[_0x5bff('0x58')]=function(_0x10df10,_0x2b0e70,_0x1575ab){var _0x5dc23a={};var _0x197110={};var _0x143149;var _0x162962;return db['ServicenowAccount']['findOne']({'where':{'id':_0x10df10[_0x5bff('0x53')]['id']}})['then'](handleEntityNotFound(_0x2b0e70,null))[_0x5bff('0x1c')](function(_0x126095){if(_0x126095){_0x143149=_0x126095;_0x197110[_0x5bff('0x3c')]=_[_0x5bff('0x3e')](db[_0x5bff('0x59')][_0x5bff('0x38')]);_0x197110[_0x5bff('0x3d')]=_[_0x5bff('0x3e')](_0x10df10[_0x5bff('0x3d')]);_0x197110[_0x5bff('0x49')]=_['intersection'](_0x197110[_0x5bff('0x3c')],_0x197110[_0x5bff('0x3d')]);_0x5dc23a[_0x5bff('0x40')]=_['intersection'](_0x197110[_0x5bff('0x3c')],qs[_0x5bff('0x41')](_0x10df10[_0x5bff('0x3d')][_0x5bff('0x41')]));_0x5dc23a[_0x5bff('0x40')]=_0x5dc23a[_0x5bff('0x40')][_0x5bff('0x42')]?_0x5dc23a['attributes']:_0x197110['model'];_0x5dc23a[_0x5bff('0x45')]=qs[_0x5bff('0x46')](_0x10df10[_0x5bff('0x3d')][_0x5bff('0x46')]);_0x5dc23a[_0x5bff('0x47')]=qs[_0x5bff('0x49')](_['pick'](_0x10df10[_0x5bff('0x3d')],_0x197110['filters']));if(_0x10df10[_0x5bff('0x3d')][_0x5bff('0x4c')]){_0x5dc23a[_0x5bff('0x47')]=_[_0x5bff('0x4a')](_0x5dc23a[_0x5bff('0x47')],{'$or':_[_0x5bff('0x36')](_0x5dc23a[_0x5bff('0x40')],function(_0x1b4235){var _0x2ea15e={};_0x2ea15e[_0x1b4235]={'$like':'%'+_0x10df10[_0x5bff('0x3d')][_0x5bff('0x4c')]+'%'};return _0x2ea15e;})});}_0x5dc23a=_[_0x5bff('0x4a')]({},_0x5dc23a,_0x10df10['options']);return _0x143149[_0x5bff('0x58')](_0x5dc23a);}})['then'](function(_0xba3d30){if(_0xba3d30){_0x162962=_0xba3d30[_0x5bff('0x42')];if(!_0x10df10['query'][_0x5bff('0x43')](_0x5bff('0x44'))){_0x5dc23a[_0x5bff('0x2c')]=qs[_0x5bff('0x2c')](_0x10df10['query'][_0x5bff('0x2c')]);_0x5dc23a[_0x5bff('0x2b')]=qs[_0x5bff('0x2b')](_0x10df10[_0x5bff('0x3d')][_0x5bff('0x2b')]);}return _0x143149['getConfigurations'](_0x5dc23a);}})['then'](function(_0x2a3a0a){if(_0x2a3a0a){return _0x2a3a0a?{'count':_0x162962,'rows':_0x2a3a0a}:null;}})[_0x5bff('0x1c')](respondWithResult(_0x2b0e70,null))[_0x5bff('0x26')](handleError(_0x2b0e70,null));};exports[_0x5bff('0x5a')]=function(_0x1206f7,_0x3ede1c,_0x536abb){if(_0x1206f7['body']['id']){delete _0x1206f7[_0x5bff('0x57')]['id'];}return db[_0x5bff('0x37')][_0x5bff('0x5b')]({'where':{'id':_0x1206f7['params']['id']}})[_0x5bff('0x1c')](handleEntityNotFound(_0x3ede1c,null))['then'](function(_0x5a9a7c){if(_0x5a9a7c){_0x1206f7[_0x5bff('0x57')]['AccountId']=_0x5a9a7c['id'];_0x1206f7[_0x5bff('0x57')][_0x5bff('0x5c')]=integrations['getSubjects'](_0x1206f7[_0x5bff('0x57')]['channel'],_0x1206f7['body']['type']);_0x1206f7['body'][_0x5bff('0x5d')]=integrations[_0x5bff('0x5e')](_0x1206f7[_0x5bff('0x57')]['channel'],_0x1206f7[_0x5bff('0x57')][_0x5bff('0x3a')]);return db[_0x5bff('0x59')][_0x5bff('0x56')](_0x1206f7[_0x5bff('0x57')],{'include':[{'model':db[_0x5bff('0x5f')],'as':'Subjects'},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})[_0x5bff('0x1c')](respondWithResult(_0x3ede1c,null))[_0x5bff('0x26')](handleError(_0x3ede1c,null));};exports[_0x5bff('0x60')]=function(_0x2b0dc7,_0x5e05be,_0x4b822b){var _0x133912=['made_sla','hold_reason',_0x5bff('0x61'),_0x5bff('0x62'),_0x5bff('0x63'),'notify','incident_state',_0x5bff('0x64'),_0x5bff('0x65')];var _0x3ed7a3=['parent',_0x5bff('0x66'),_0x5bff('0x67'),_0x5bff('0x68'),_0x5bff('0x69'),'sys_updated_on','child_incidents',_0x5bff('0x6a'),'approval_history',_0x5bff('0x6b'),_0x5bff('0x6c'),_0x5bff('0x6d'),_0x5bff('0x6e'),_0x5bff('0x6f'),_0x5bff('0x70'),_0x5bff('0x71'),_0x5bff('0x72'),_0x5bff('0x73'),'knowledge',_0x5bff('0x45'),_0x5bff('0x74'),_0x5bff('0x75'),_0x5bff('0x76'),'delivery_plan',_0x5bff('0x77'),_0x5bff('0x78'),_0x5bff('0x79'),_0x5bff('0x7a'),_0x5bff('0x7b'),_0x5bff('0x7c'),'rfc','time_worked','expected_start','opened_at',_0x5bff('0x7d'),_0x5bff('0x7e'),_0x5bff('0x7f'),_0x5bff('0x80'),_0x5bff('0x81'),_0x5bff('0x82'),'approval_set',_0x5bff('0x62'),_0x5bff('0x83'),_0x5bff('0x84'),_0x5bff('0x63'),_0x5bff('0x85'),_0x5bff('0x86'),_0x5bff('0x87'),_0x5bff('0x88'),'business_stc',_0x5bff('0x89'),_0x5bff('0x8a'),_0x5bff('0x8b'),_0x5bff('0x8c'),'sys_class_name',_0x5bff('0x8d'),_0x5bff('0x8e'),_0x5bff('0x8f'),_0x5bff('0x90'),_0x5bff('0x91'),_0x5bff('0x92'),_0x5bff('0x93'),'incident_state','urgency',_0x5bff('0x94'),_0x5bff('0x95'),'reassignment_count',_0x5bff('0x96'),'assigned_to',_0x5bff('0x64'),'comments',_0x5bff('0x97'),_0x5bff('0x98'),_0x5bff('0x99'),_0x5bff('0x9a'),_0x5bff('0x9b'),_0x5bff('0x9c'),_0x5bff('0x9d'),_0x5bff('0x9e'),'upon_approval',_0x5bff('0x9f'),_0x5bff('0xa0'),_0x5bff('0x65')];var _0xeaef76='';var _0x3f75d7='';var _0x183976=[];var _0x595887='';var _0x396fc2='';var _0x3e2e63=[];var _0x5652c7='';var _0x5983fa='';var _0x3d8a89={};var _0x3def1e='';return db['ServicenowAccount'][_0x5bff('0x5b')]({'where':{'id':_0x2b0dc7[_0x5bff('0x53')]['id']},'attributes':['id','username',_0x5bff('0xa1'),'email','remoteUri','serverUrl']})['then'](handleEntityNotFound(_0x5e05be,null))['then'](function(_0x4d1725){if(_0x4d1725){_0x3def1e=_0x4d1725[_0x5bff('0xa2')];var _0x55c8d9=_0x3def1e['slice'](-0x1);if(_0x55c8d9==='/'){_0x3def1e=_0x3def1e[_0x5bff('0xa3')](0x0,_0x3def1e['lastIndexOf'](_0x55c8d9));}_0x5983fa=util[_0x5bff('0xa4')](_0x5bff('0xa5'),_0x3def1e);_0x5652c7=util['format'](_0x5bff('0xa6'),_0x3def1e);_0x3d8a89={'user':_0x4d1725[_0x5bff('0xa7')],'pass':_0x4d1725['password']};var _0x5ebad3={'method':_0x5bff('0xa8'),'uri':_0x5983fa+_0x5bff('0xa9'),'auth':_0x3d8a89,'json':!![]};return rp(_0x5ebad3);}})[_0x5bff('0x1c')](function(_0x3d8c4a){if(_0x3d8c4a['result'][_0x5bff('0x42')]>0x0){_0xeaef76=_0x3d8c4a[_0x5bff('0xaa')];}console[_0x5bff('0xab')](_0x5bff('0xac'),_0xeaef76);_0x3e2e63=[];_0x3f75d7=Object['assign']([],_0xeaef76);_[_0x5bff('0xad')](_0x3f75d7,function(_0x51d0d4){return!_0x133912[_0x5bff('0xae')](_0x51d0d4[_0x5bff('0x35')]);});_0x3f75d7[_0x5bff('0xaf')](function(_0x2ec528){var _0x576260=createFieldObject(_0x5652c7,_0x3d8a89,_0x2ec528['internalType'],_0x2ec528[_0x5bff('0x35')],_0x2ec528[_0x5bff('0xb0')],![]);_0x3e2e63['push'](_0x576260);});return Promise['all'](_0x3e2e63);})['then'](function(_0x1e9df6){_0x183976=_0x1e9df6;_0x595887=Object[_0x5bff('0xb1')]([],_0xeaef76);console[_0x5bff('0xab')](_0x5bff('0xb2'),_0xeaef76);_[_0x5bff('0xad')](_0x595887,function(_0x43ee05){return _0x3ed7a3[_0x5bff('0xae')](_0x43ee05[_0x5bff('0x35')]);});console[_0x5bff('0xab')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x595887);_0x3e2e63=[];_0x595887[_0x5bff('0xaf')](function(_0x40a44f){var _0x1b5917=createFieldObject(_0x5652c7,_0x3d8a89,_0x40a44f[_0x5bff('0xb3')],_0x40a44f[_0x5bff('0x35')],_0x40a44f[_0x5bff('0xb0')],!![]);_0x3e2e63[_0x5bff('0xb4')](_0x1b5917);});return Promise['all'](_0x3e2e63);})[_0x5bff('0x1c')](function(_0x780920){_0x396fc2=_0x780920;var _0x46e90b=_0x183976[_0x5bff('0xb5')](_0x396fc2);return{'count':_0x46e90b[_0x5bff('0x42')],'rows':_0x46e90b};})[_0x5bff('0x1c')](respondWithResult(_0x5e05be,null))[_0x5bff('0x26')](function(_0x2849e8){console[_0x5bff('0xab')](_0x5bff('0xb6')+_0x2849e8);var _0x5b6b67=_0x2b0dc7[_0x5bff('0x3d')][_0x5bff('0xb7')]?0x1f4:_0x2849e8[_0x5bff('0xb8')]||0x1f4;logger[_0x5bff('0x22')](_0x2849e8[_0x5bff('0x34')]);delete _0x2849e8[_0x5bff('0x35')];if(_0x5b6b67===0x191){_0x5b6b67=0x190;}_0x5e05be[_0x5bff('0x28')](_0x5b6b67)['send'](_0x2b0dc7[_0x5bff('0x3d')][_0x5bff('0xb7')]?{'message':_0x5bff('0xb9'),'statusCode':_0x2849e8[_0x5bff('0xb8')]}:_0x2849e8);});};function createFieldObject(_0x5308bc,_0x20735c,_0x4b1108,_0x391db5,_0x569956,_0x2c0bc0){return new Promise(function(_0x27b240,_0x40185a){var _0x4b20bb={'id':_0x391db5,'name':_0x569956,'custom':_0x2c0bc0};if(_0x4b1108===_0x5bff('0xba')){_0x4b20bb[_0x5bff('0x4d')]=[{'name':'True','value':_0x5bff('0xbb')},{'name':_0x5bff('0xbc'),'value':'false'}];_0x27b240(_0x4b20bb);}else{var _0x452cba={'method':'GET','uri':_0x5308bc+_0x5bff('0xbd')+_0x391db5,'auth':_0x20735c,'json':!![]};return rp(_0x452cba)[_0x5bff('0x1c')](function(_0x3a3bae){var _0x4f6511=[];if(_0x3a3bae['result'][_0x5bff('0x42')]>0x0){_0x3a3bae[_0x5bff('0xaa')][_0x5bff('0xaf')](function(_0x6adc36){if(_0x6adc36[_0x5bff('0xbe')]==='false'){var _0xe3cd80={'name':_0x6adc36[_0x5bff('0xb0')],'value':_0x6adc36[_0x5bff('0xbf')]};_0x4f6511[_0x5bff('0xb4')](_0xe3cd80);}});}_0x4b20bb[_0x5bff('0x4d')]=_0x4f6511;if(_0x4b20bb['options'][_0x5bff('0x42')]>0x0){_0x27b240(_0x4b20bb);}else{if(_0x2c0bc0==![]){_0x27b240();}else{_0x27b240(_0x4b20bb);}}});}});}