Built motion from commit (unavailable).|2.5.21
[motion2.git] / server / api / intZohoAccount / intZohoAccount.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 _0x8ff9=['Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','system_mandatory','push','data_type','pick_list_values','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../components/integrations/configuration','jayson/promise','client','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','getConfigurations','findOne','ZohoConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','clientSecret','serverUrl','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Subject'];(function(_0x1d5557,_0x515aba){var _0x18c8d0=function(_0x675abe){while(--_0x675abe){_0x1d5557['push'](_0x1d5557['shift']());}};_0x18c8d0(++_0x515aba);}(_0x8ff9,0x1a6));var _0x98ff=function(_0x4b1136,_0x3fb19e){_0x4b1136=_0x4b1136-0x0;var _0x1faa45=_0x8ff9[_0x4b1136];return _0x1faa45;};'use strict';var pdf=require(_0x98ff('0x0'));var emlformat=require(_0x98ff('0x1'));var rimraf=require(_0x98ff('0x2'));var zipdir=require(_0x98ff('0x3'));var jsonpatch=require(_0x98ff('0x4'));var rp=require(_0x98ff('0x5'));var moment=require(_0x98ff('0x6'));var BPromise=require(_0x98ff('0x7'));var Mustache=require(_0x98ff('0x8'));var util=require(_0x98ff('0x9'));var path=require(_0x98ff('0xa'));var sox=require('sox');var csv=require(_0x98ff('0xb'));var ejs=require(_0x98ff('0xc'));var fs=require('fs');var _=require(_0x98ff('0xd'));var squel=require(_0x98ff('0xe'));var crypto=require(_0x98ff('0xf'));var jsforce=require(_0x98ff('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x98ff('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x98ff('0x11'));var authService=require(_0x98ff('0x12'));var qs=require(_0x98ff('0x13'));var as=require(_0x98ff('0x14'));var hardwareService=require(_0x98ff('0x15'));var logger=require('../../config/logger')(_0x98ff('0x16'));var utils=require('../../config/utils');var config=require(_0x98ff('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x98ff('0x18'));var jayson=require(_0x98ff('0x19'));var client=jayson[_0x98ff('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd359c2,_0x5b0080,_0x7af35,_0x373e14){return new BPromise(function(_0x2c4e4d,_0x3a7e21){var _0x2aae4d=_0x373e14||client;return _0x2aae4d[_0x98ff('0x1b')](_0xd359c2,_0x7af35)['then'](function(_0x3573a4){logger[_0x98ff('0x1c')](_0x98ff('0x1d'),_0x5b0080,_0x98ff('0x1e'));logger[_0x98ff('0x1f')](_0x98ff('0x20'),_0x5b0080,_0x98ff('0x1e'),JSON[_0x98ff('0x21')](_0x3573a4));if(_0x3573a4[_0x98ff('0x22')]){if(_0x3573a4[_0x98ff('0x22')][_0x98ff('0x23')]===0x1f4){logger[_0x98ff('0x22')](_0x98ff('0x1d'),_0x5b0080,_0x3573a4[_0x98ff('0x22')]['message']);return _0x3a7e21(_0x3573a4[_0x98ff('0x22')][_0x98ff('0x24')]);}logger[_0x98ff('0x22')](_0x98ff('0x1d'),_0x5b0080,_0x3573a4[_0x98ff('0x22')][_0x98ff('0x24')]);return _0x2c4e4d(_0x3573a4[_0x98ff('0x22')][_0x98ff('0x24')]);}else{logger[_0x98ff('0x1c')](_0x98ff('0x1d'),_0x5b0080,_0x98ff('0x1e'));_0x2c4e4d(_0x3573a4[_0x98ff('0x25')][_0x98ff('0x24')]);}})['catch'](function(_0x5155bf){logger['error'](_0x98ff('0x1d'),_0x5b0080,_0x5155bf);_0x3a7e21(_0x5155bf);});});}function respondWithStatusCode(_0x3ee01b,_0x547fab){_0x547fab=_0x547fab||0xcc;return function(_0xd0293e){if(_0xd0293e){return _0x3ee01b['sendStatus'](_0x547fab);}return _0x3ee01b[_0x98ff('0x26')](_0x547fab)[_0x98ff('0x27')]();};}function respondWithResult(_0x308efd,_0x2b3ee9){_0x2b3ee9=_0x2b3ee9||0xc8;return function(_0x4003de){if(_0x4003de){return _0x308efd['status'](_0x2b3ee9)['json'](_0x4003de);}};}function respondWithFilteredResult(_0xf53ff7,_0x1a4ebd){return function(_0x17f6aa){if(_0x17f6aa){var _0x6ccf21=_0x17f6aa[_0x98ff('0x28')],_0x8b7939=_0x1a4ebd[_0x98ff('0x29')],_0x231e00=_0x1a4ebd[_0x98ff('0x29')]+_0x1a4ebd['limit'],_0x1c7fdb;if(_0x231e00>=_0x6ccf21){_0x231e00=_0x6ccf21;_0x1c7fdb=0xc8;}else{_0x1c7fdb=0xce;}_0xf53ff7[_0x98ff('0x26')](_0x1c7fdb);return _0xf53ff7[_0x98ff('0x2a')](_0x98ff('0x2b'),_0x8b7939+'-'+_0x231e00+'/'+_0x6ccf21)[_0x98ff('0x2c')](_0x17f6aa);}return null;};}function patchUpdates(_0x31eeab){return function(_0x3ff688){try{jsonpatch[_0x98ff('0x2d')](_0x3ff688,_0x31eeab,!![]);}catch(_0x41c093){return BPromise[_0x98ff('0x2e')](_0x41c093);}return _0x3ff688[_0x98ff('0x2f')]();};}function saveUpdates(_0x3fa70c,_0x1472cb){return function(_0x257722){if(_0x257722){return _0x257722[_0x98ff('0x30')](_0x3fa70c)[_0x98ff('0x31')](function(_0x81e918){return _0x81e918;});}return null;};}function removeEntity(_0x249807,_0x12d6cc){return function(_0x2c466e){if(_0x2c466e){return _0x2c466e[_0x98ff('0x32')]()[_0x98ff('0x31')](function(){_0x249807['status'](0xcc)[_0x98ff('0x27')]();});}};}function handleEntityNotFound(_0x415432,_0x3bb8cf){return function(_0x1986e3){if(!_0x1986e3){_0x415432[_0x98ff('0x33')](0x194);}return _0x1986e3;};}function handleError(_0x5181f8,_0x22060f){_0x22060f=_0x22060f||0x1f4;return function(_0x56b676){logger[_0x98ff('0x22')](_0x56b676[_0x98ff('0x34')]);if(_0x56b676[_0x98ff('0x35')]){delete _0x56b676[_0x98ff('0x35')];}_0x5181f8[_0x98ff('0x26')](_0x22060f)[_0x98ff('0x36')](_0x56b676);};}exports[_0x98ff('0x37')]=function(_0x4419a7,_0x2f708e){var _0x4640d9={},_0x56cda6={},_0x20c907={'count':0x0,'rows':[]};var _0x322bc2=_[_0x98ff('0x38')](db[_0x98ff('0x39')][_0x98ff('0x3a')],function(_0x6e2f29){return{'name':_0x6e2f29[_0x98ff('0x3b')],'type':_0x6e2f29[_0x98ff('0x3c')]['key']};});_0x56cda6[_0x98ff('0x3d')]=_['map'](_0x322bc2,_0x98ff('0x35'));_0x56cda6[_0x98ff('0x3e')]=_[_0x98ff('0x3f')](_0x4419a7[_0x98ff('0x3e')]);_0x56cda6[_0x98ff('0x40')]=_['intersection'](_0x56cda6['model'],_0x56cda6[_0x98ff('0x3e')]);_0x4640d9[_0x98ff('0x41')]=_[_0x98ff('0x42')](_0x56cda6[_0x98ff('0x3d')],qs[_0x98ff('0x43')](_0x4419a7[_0x98ff('0x3e')][_0x98ff('0x43')]));_0x4640d9['attributes']=_0x4640d9[_0x98ff('0x41')][_0x98ff('0x44')]?_0x4640d9[_0x98ff('0x41')]:_0x56cda6[_0x98ff('0x3d')];if(!_0x4419a7[_0x98ff('0x3e')][_0x98ff('0x45')](_0x98ff('0x46'))){_0x4640d9['limit']=qs[_0x98ff('0x47')](_0x4419a7[_0x98ff('0x3e')][_0x98ff('0x47')]);_0x4640d9[_0x98ff('0x29')]=qs[_0x98ff('0x29')](_0x4419a7['query']['offset']);}_0x4640d9[_0x98ff('0x48')]=qs['sort'](_0x4419a7[_0x98ff('0x3e')][_0x98ff('0x49')]);_0x4640d9[_0x98ff('0x4a')]=qs[_0x98ff('0x40')](_[_0x98ff('0x4b')](_0x4419a7[_0x98ff('0x3e')],_0x56cda6['filters']),_0x322bc2);if(_0x4419a7['query'][_0x98ff('0x4c')]){_0x4640d9['where']=_[_0x98ff('0x4d')](_0x4640d9[_0x98ff('0x4a')],{'$or':_[_0x98ff('0x38')](_0x322bc2,function(_0x1be690){if(_0x1be690[_0x98ff('0x3c')]!==_0x98ff('0x4e')){var _0x5b8f25={};_0x5b8f25[_0x1be690[_0x98ff('0x35')]]={'$like':'%'+_0x4419a7[_0x98ff('0x3e')][_0x98ff('0x4c')]+'%'};return _0x5b8f25;}})});}_0x4640d9=_['merge']({},_0x4640d9,_0x4419a7[_0x98ff('0x4f')]);var _0x454add={'where':_0x4640d9[_0x98ff('0x4a')]};return db[_0x98ff('0x39')][_0x98ff('0x28')](_0x454add)[_0x98ff('0x31')](function(_0x3006f3){_0x20c907[_0x98ff('0x28')]=_0x3006f3;if(_0x4419a7[_0x98ff('0x3e')][_0x98ff('0x50')]){_0x4640d9[_0x98ff('0x51')]=[{'all':!![]}];}return db[_0x98ff('0x39')][_0x98ff('0x52')](_0x4640d9);})[_0x98ff('0x31')](function(_0x44aedb){_0x20c907[_0x98ff('0x53')]=_0x44aedb;return _0x20c907;})['then'](respondWithFilteredResult(_0x2f708e,_0x4640d9))['catch'](handleError(_0x2f708e,null));};exports[_0x98ff('0x54')]=function(_0x4c2b0e,_0x462b54){var _0x8fbd2e={'raw':![],'where':{'id':_0x4c2b0e[_0x98ff('0x55')]['id']}},_0x414152={};_0x414152[_0x98ff('0x3d')]=_[_0x98ff('0x3f')](db[_0x98ff('0x39')][_0x98ff('0x3a')]);_0x414152[_0x98ff('0x3e')]=_['keys'](_0x4c2b0e[_0x98ff('0x3e')]);_0x414152['filters']=_[_0x98ff('0x42')](_0x414152[_0x98ff('0x3d')],_0x414152['query']);_0x8fbd2e[_0x98ff('0x41')]=_[_0x98ff('0x42')](_0x414152['model'],qs[_0x98ff('0x43')](_0x4c2b0e[_0x98ff('0x3e')]['fields']));_0x8fbd2e[_0x98ff('0x41')]=_0x8fbd2e[_0x98ff('0x41')][_0x98ff('0x44')]?_0x8fbd2e[_0x98ff('0x41')]:_0x414152[_0x98ff('0x3d')];if(_0x4c2b0e[_0x98ff('0x3e')]['includeAll']){_0x8fbd2e[_0x98ff('0x51')]=[{'all':!![]}];}_0x8fbd2e=_[_0x98ff('0x4d')]({},_0x8fbd2e,_0x4c2b0e[_0x98ff('0x4f')]);return db[_0x98ff('0x39')][_0x98ff('0x56')](_0x8fbd2e)[_0x98ff('0x31')](handleEntityNotFound(_0x462b54,null))[_0x98ff('0x31')](respondWithResult(_0x462b54,null))[_0x98ff('0x57')](handleError(_0x462b54,null));};exports[_0x98ff('0x58')]=function(_0x2ef341,_0x1d30ea){return db['ZohoAccount']['create'](_0x2ef341[_0x98ff('0x59')],{})[_0x98ff('0x31')](respondWithResult(_0x1d30ea,0xc9))[_0x98ff('0x57')](handleError(_0x1d30ea,null));};exports[_0x98ff('0x30')]=function(_0x39c854,_0xb97b48){if(_0x39c854[_0x98ff('0x59')]['id']){delete _0x39c854[_0x98ff('0x59')]['id'];}return db[_0x98ff('0x39')]['find']({'where':{'id':_0x39c854[_0x98ff('0x55')]['id']}})[_0x98ff('0x31')](handleEntityNotFound(_0xb97b48,null))[_0x98ff('0x31')](saveUpdates(_0x39c854[_0x98ff('0x59')],null))[_0x98ff('0x31')](respondWithResult(_0xb97b48,null))[_0x98ff('0x57')](handleError(_0xb97b48,null));};exports[_0x98ff('0x32')]=function(_0x40f88f,_0x2e0406){return db[_0x98ff('0x39')]['find']({'where':{'id':_0x40f88f['params']['id']}})[_0x98ff('0x31')](handleEntityNotFound(_0x2e0406,null))[_0x98ff('0x31')](removeEntity(_0x2e0406,null))['catch'](handleError(_0x2e0406,null));};exports[_0x98ff('0x5a')]=function(_0x4d290c,_0x4b9ae1,_0x1f4f06){var _0x44a0a0={};var _0x5e3f71={};var _0x4f97c9;var _0x432081;return db[_0x98ff('0x39')][_0x98ff('0x5b')]({'where':{'id':_0x4d290c[_0x98ff('0x55')]['id']}})[_0x98ff('0x31')](handleEntityNotFound(_0x4b9ae1,null))['then'](function(_0x124922){if(_0x124922){_0x4f97c9=_0x124922;_0x5e3f71[_0x98ff('0x3d')]=_[_0x98ff('0x3f')](db[_0x98ff('0x5c')][_0x98ff('0x3a')]);_0x5e3f71[_0x98ff('0x3e')]=_['keys'](_0x4d290c['query']);_0x5e3f71[_0x98ff('0x40')]=_[_0x98ff('0x42')](_0x5e3f71[_0x98ff('0x3d')],_0x5e3f71['query']);_0x44a0a0[_0x98ff('0x41')]=_[_0x98ff('0x42')](_0x5e3f71[_0x98ff('0x3d')],qs[_0x98ff('0x43')](_0x4d290c[_0x98ff('0x3e')][_0x98ff('0x43')]));_0x44a0a0[_0x98ff('0x41')]=_0x44a0a0[_0x98ff('0x41')]['length']?_0x44a0a0[_0x98ff('0x41')]:_0x5e3f71[_0x98ff('0x3d')];_0x44a0a0['order']=qs[_0x98ff('0x49')](_0x4d290c[_0x98ff('0x3e')][_0x98ff('0x49')]);_0x44a0a0[_0x98ff('0x4a')]=qs['filters'](_[_0x98ff('0x4b')](_0x4d290c['query'],_0x5e3f71['filters']));if(_0x4d290c[_0x98ff('0x3e')][_0x98ff('0x4c')]){_0x44a0a0[_0x98ff('0x4a')]=_[_0x98ff('0x4d')](_0x44a0a0[_0x98ff('0x4a')],{'$or':_[_0x98ff('0x38')](_0x44a0a0[_0x98ff('0x41')],function(_0x12bbb){var _0x4880d2={};_0x4880d2[_0x12bbb]={'$like':'%'+_0x4d290c[_0x98ff('0x3e')][_0x98ff('0x4c')]+'%'};return _0x4880d2;})});}_0x44a0a0=_['merge']({},_0x44a0a0,_0x4d290c['options']);return _0x4f97c9['getConfigurations'](_0x44a0a0);}})[_0x98ff('0x31')](function(_0x58c4ab){if(_0x58c4ab){_0x432081=_0x58c4ab[_0x98ff('0x44')];if(!_0x4d290c[_0x98ff('0x3e')][_0x98ff('0x45')](_0x98ff('0x46'))){_0x44a0a0[_0x98ff('0x47')]=qs[_0x98ff('0x47')](_0x4d290c[_0x98ff('0x3e')][_0x98ff('0x47')]);_0x44a0a0[_0x98ff('0x29')]=qs[_0x98ff('0x29')](_0x4d290c[_0x98ff('0x3e')][_0x98ff('0x29')]);}return _0x4f97c9[_0x98ff('0x5a')](_0x44a0a0);}})['then'](function(_0x1fe438){if(_0x1fe438){return _0x1fe438?{'count':_0x432081,'rows':_0x1fe438}:null;}})['then'](respondWithResult(_0x4b9ae1,null))[_0x98ff('0x57')](handleError(_0x4b9ae1,null));};exports['addConfiguration']=function(_0x5ad0ae,_0x50ec35,_0x35f31e){if(_0x5ad0ae[_0x98ff('0x59')]['id']){delete _0x5ad0ae[_0x98ff('0x59')]['id'];}return db[_0x98ff('0x39')]['findOne']({'where':{'id':_0x5ad0ae[_0x98ff('0x55')]['id']}})[_0x98ff('0x31')](handleEntityNotFound(_0x50ec35,null))[_0x98ff('0x31')](function(_0x2595ac){if(_0x2595ac){_0x5ad0ae['body']['AccountId']=_0x2595ac['id'];_0x5ad0ae['body'][_0x98ff('0x5d')]=integrations[_0x98ff('0x5e')](_0x5ad0ae[_0x98ff('0x59')][_0x98ff('0x5f')],_0x5ad0ae[_0x98ff('0x59')]['type']);_0x5ad0ae[_0x98ff('0x59')][_0x98ff('0x60')]=integrations[_0x98ff('0x61')](_0x5ad0ae[_0x98ff('0x59')][_0x98ff('0x5f')],_0x5ad0ae['body'][_0x98ff('0x3c')]);return db['ZohoConfiguration']['create'](_0x5ad0ae[_0x98ff('0x59')],{'include':[{'model':db[_0x98ff('0x62')],'as':_0x98ff('0x5d')},{'model':db[_0x98ff('0x62')],'as':_0x98ff('0x60')}]});}return null;})['then'](respondWithResult(_0x50ec35,null))[_0x98ff('0x57')](handleError(_0x50ec35,null));};function getAccessToken(_0x5f197d){return new Promise(function(_0x5302ac,_0x321f61){var _0x26c80e;switch(_0x5f197d[_0x98ff('0x63')]){case'US':_0x26c80e='https://accounts.zoho.com';break;case'AU':_0x26c80e=_0x98ff('0x64');break;case'EU':_0x26c80e=_0x98ff('0x65');break;case'IN':_0x26c80e=_0x98ff('0x66');break;case'CN':_0x26c80e=_0x98ff('0x67');break;default:_0x26c80e=_0x98ff('0x65');break;}var _0xcf6d0={'method':_0x98ff('0x68'),'uri':_0x26c80e+'/oauth/v2/token','qs':{'refresh_token':_0x5f197d[_0x98ff('0x69')],'client_id':_0x5f197d['clientId'],'client_secret':_0x5f197d['clientSecret'],'grant_type':_0x98ff('0x6a')},'json':!![]};return rp(_0xcf6d0)[_0x98ff('0x31')](function(_0x460bed){if(_0x460bed[_0x98ff('0x6b')]){_0x5302ac(_0x460bed[_0x98ff('0x6b')]);}else{_0x321f61(_0x98ff('0x6c'));}})[_0x98ff('0x57')](function(_0x33acd3){_0x321f61(_0x33acd3);});});}exports[_0x98ff('0x6d')]=function(_0x406949,_0x5efbdc,_0x27dcfe){var _0xf01703,_0x118c84,_0x5274e7,_0x25672b,_0x379d50;return db[_0x98ff('0x39')]['findOne']({'where':{'id':_0x406949[_0x98ff('0x55')]['id']},'attributes':['id',_0x98ff('0x6e'),_0x98ff('0x63'),_0x98ff('0x6f'),_0x98ff('0x70'),_0x98ff('0x71'),_0x98ff('0x23'),_0x98ff('0x69')]})['then'](handleEntityNotFound(_0x5efbdc,null))[_0x98ff('0x31')](function(_0x1b37f2){_0x379d50=_0x1b37f2;_0xf01703=_0x379d50[_0x98ff('0x6e')];_0x118c84=_0xf01703==='zoho.eu'?'eu':'com';_0x5274e7=_0x379d50['serverUrl'];var _0x48dcb5=_0x5274e7['slice'](-0x1);if(_0x48dcb5==='/'||_0x48dcb5==='\x5c'||_0x48dcb5===':'){_0x5274e7=_0x5274e7[_0x98ff('0x72')](0x0,_0x5274e7[_0x98ff('0x73')](_0x48dcb5));}if(!_0x379d50[_0x98ff('0x69')]){throw new Error(_0x98ff('0x74'));}return getAccessToken(_0x379d50);})[_0x98ff('0x31')](function(_0x2a9458){if(_0x2a9458){return rp({'method':'GET','uri':util[_0x98ff('0x75')](_0x98ff('0x76'),_0x118c84),'qs':{'module':_0x98ff('0x77')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2a9458},'json':!![]});}})['then'](function(_0x591239){if(_0x591239){if(_0x591239[_0x98ff('0x78')]&&_0x591239['response'][_0x98ff('0x22')]){throw new Error(_0x591239[_0x98ff('0x78')][_0x98ff('0x22')][_0x98ff('0x24')]);}var _0x52e8af=[];var _0x5279de=[];var _0x4b7100=['Owner',_0x98ff('0x79'),_0x98ff('0x7a'),_0x98ff('0x7b'),_0x98ff('0x7c'),_0x98ff('0x7d'),_0x98ff('0x7e'),_0x98ff('0x7f')];_0x5279de=_['remove'](_0x591239[_0x98ff('0x43')],function(_0x4ba137){return _0x4b7100[_0x98ff('0x80')](_0x4ba137['api_name']);});for(var _0x486e91=0x0;_0x486e91<_0x5279de['length'];_0x486e91++){if(_0x5279de[_0x486e91][_0x98ff('0x81')]===![]){_0x52e8af[_0x98ff('0x82')]({'id':_0x5279de[_0x486e91]['id'],'name':_0x5279de[_0x486e91]['display_label'],'custom':_0x5279de[_0x486e91]['custom_field'],'options':_0x5279de[_0x486e91][_0x98ff('0x83')]==='picklist'&&_0x5279de[_0x486e91][_0x98ff('0x84')][_0x98ff('0x44')]>-0x1?_[_0x98ff('0x38')](_0x5279de[_0x486e91][_0x98ff('0x84')],function(_0x1087aa){return{'name':_0x1087aa,'value':_0x1087aa};}):[]});}}return{'count':_0x52e8af[_0x98ff('0x44')],'rows':_0x52e8af};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x5efbdc,null))['catch'](function(_0x61dcdf){var _0x2321fd=_0x406949[_0x98ff('0x3e')][_0x98ff('0x85')]?0x1f4:_0x61dcdf[_0x98ff('0x86')]||0x1f4;logger[_0x98ff('0x22')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x2321fd,JSON[_0x98ff('0x21')](_0x61dcdf));delete _0x61dcdf[_0x98ff('0x35')];if(_0x2321fd===0x191){_0x2321fd=0x190;}_0x5efbdc[_0x98ff('0x26')](_0x2321fd)[_0x98ff('0x36')](_0x406949[_0x98ff('0x3e')][_0x98ff('0x85')]?{'message':_0x98ff('0x87'),'statusCode':_0x61dcdf[_0x98ff('0x86')]}:_0x61dcdf);});};