import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/asyncToGenerator";import r from"@babel/runtime/regenerator";import n from"jsona";import{getRigs as i,getFracFleets as a,getDrilloutUnits as o,getPads as l,getWells as c,getInterventionUnits as s}from"../../../../../clients/jsonApi/index.js";function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?p(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var d=new n,u={rig:i,frac_fleet:a,drillout_unit:o,pad:l,well:c,intervention_unit:s},f={rig:["rig.name","rig.asset_id","rig.type","rig.active_well"],frac_fleet:["frac_fleet.name","frac_fleet.type","frac_fleet.current_pad_id","frac_fleet.pad_frac_fleets"],drillout_unit:["drillout_unit.name","drillout_unit.type"],well:["well.name","well.asset_id","well.type","well.rig_id","well.last_active_at","well.status"],pad:["pad.name","pad.asset_id","pad.type","pad.current_frac_fleet_id","pad.parent_frac_fleet_id","pad.active","pad.current"],intervention_unit:["intervention_unit.name","intervention_unit.type","intervention_unit.active_well"]},m={rig:{sort:"last_active_at",order:"desc"},frac_fleet:{sort:"last_active_at",order:"desc"},drillout_unit:{sort:"last_active_at",order:"desc"},well:{sort:"last_active_at",order:"desc"},pad:{sort:"last_active_at",order:"desc"},intervention_unit:{sort:"created_at",order:"desc"}},v={intervention_unit:"intervention_unit_id",rig:"rig",frac_fleet:"frac_fleet"},g=function(){var n=t(r.mark((function t(n){var i,a,o,l,c,s,p,g,b,y,w;return r.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=n.assetType,a=n.parentId,o=n.searchString,l=void 0===o?"":o,c=n.page,s=n.perPage,p=n.ids,g=n.parentType,b=n.additionalParams,y=u[i],t.next=4,y(_(_(_({per_page:s,fields:f[i],page:c},i in m?m[i]:{}),a&&g&&!l.trim()?e({},v[g],Number(a)):{search:l}),{},{ids:p},b));case 4:return w=t.sent,t.abrupt("return",d.deserialize(w));case 6:case"end":return t.stop()}}),t)})));return function(e){return n.apply(this,arguments)}}();export{g as loadAssets};
//# sourceMappingURL=loadAssets.js.map
