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