Built motion from commit (unavailable).|2.5.18
[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 _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);}}});}});}