"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/regenerator"),r=require("../constants.js"),n=require("../transformers/transformAssetToOffsetWell.js"),s=require("./fetchDataByChunks.js"),a=require("./assetsFetcher.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=u(e),i=u(t),o=function(){var e=l.default(i.default.mark((function e(t,u){var o,f,c,p,d,h;return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f=(o=null!=u?u:{}).signal,c=o.onProgress,p=o.drillingWells,null==c||c({loaded:0,isComplete:!1}),e.next=4,s.fetchDataByChunks({path:"/v2/assets",queryParams:{types:["well"],company_id:t&&t.length>0?t:void 0,last_active_drilling_after:p?1:void 0,fields:r.ASSET_FIELDS,sort:"name"},chunkSize:2e3,paginationStyle:"page",fetcher:function(){var e=l.default(i.default.mark((function e(t,r,n){var s;return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.assetsFetcher(t,r,n);case 2:return s=e.sent,null==c||c({loaded:2e3*r.page,isComplete:!1}),e.abrupt("return",s);case 5:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),signal:f});case 4:return d=e.sent,h=d.map((function(e){return n.transformAssetToOffsetWell(e)})),null==c||c({loaded:h.length,isComplete:!0}),e.abrupt("return",h);case 8:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}();exports.getAllAssets=o;
//# sourceMappingURL=getAllAssets.js.map
