import t from"@babel/runtime/helpers/asyncToGenerator";import e from"@babel/runtime/regenerator";import{get as r}from"lodash";import{getAppStorage as a,getAssets as s}from"../../../clients/jsonApi/index.js";function n(t,e){return i.apply(this,arguments)}function i(){return(i=t(e.mark((function t(a,n){var i,u,o;return e.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=null,t.prev=1,t.next=4,s({types:["well"],company_id:a?+a:void 0,fields:["asset.name","asset.parent_asset_id","asset.parent_asset_name","asset.stats","asset.target_formation","asset.string_design","asset.root_asset_name","asset.basin","asset.county","asset.area","asset.visibility","asset.top_hole"],per_page:1e4,sort:"name"});case 4:i=t.sent,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),console.error(t.t0);case 10:if(u=i?i.data.map((function(t){return{id:Number(t.id),name:r(t,"attributes.name"),rigId:r(t,"attributes.parent_asset_id")||"Null",rigName:r(t,"attributes.parent_asset_name")||"Null",formation:r(t,"attributes.target_formation")||"Null",stringDesign:r(t,"attributes.string_design")||"Null",programName:r(t,"attributes.root_asset_name")||"Null",basin:r(t,"attributes.basin")||"Null",county:r(t,"attributes.county")||"Null",area:r(t,"attributes.area")||"Null",visibility:r(t,"attributes.visibility"),topHole:r(t,"attributes.top_hole"),rigReleaseDate:r(t,"attributes.stats.well_end"),totalDepth:r(t,"attributes.stats.total_depth"),is_usable:!0}})).filter((function(t){return"visible"===t.visibility})):[],!n){t.next=16;break}return t.next=14,n(u);case 14:return o=t.sent,t.abrupt("return",o);case 16:return t.abrupt("return",u);case 17:case"end":return t.stop()}}),t,null,[[1,7]])})))).apply(this,arguments)}function u(t){return o.apply(this,arguments)}function o(){return(o=t(e.mark((function t(r){return e.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",a("corva","data.offset-wells.bic",r,{limit:1,sort:"{timestamp: -1}"}));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export{u as fetchBicWellSections,n as fetchWells};
//# sourceMappingURL=apiCalls.js.map
