"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/regenerator"),n=require("lodash"),a=require("../../constants.js"),i=require("../shared/dataFormatter.js"),o=require("../../../../clients/jsonApi/index.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=s(e),u=s(r),l=s(t);function p(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function f(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?p(Object(t),!0).forEach((function(r){c.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):p(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var b=function(){var e=u.default(l.default.mark((function e(r,t,s){var c,u,p,b;return l.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c=["rig.name","rig.active_well","rig.asset_id"],u={company:s&&s.length>0?s:void 0,search:r,per_page:a.ROWS_PER_PAGE,page:t,fields:c,sort:"name"},e.prev=2,e.next=5,o.getRigs(u);case 5:p=e.sent,e.next=12;break;case 8:e.prev=8,e.t0=e.catch(2),console.error(e.t0),p=[];case 12:return b=i.dataFormatter.deserialize(p),e.abrupt("return",b.map((function(e){return f({redirectAssetId:n.get(e,["active_well","asset_id"])||null},e)})));case 14:case"end":return e.stop()}}),e,null,[[2,8]])})));return function(r,t,n){return e.apply(this,arguments)}}();exports.fetchRigs=b;
//# sourceMappingURL=fetchRigs.js.map
