"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),r=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/regenerator"),a=require("../shared/constants.js"),n=require("../shared/fetchers/fetchDataByChunks.js"),u=require("../../../../clients/jsonApi/index.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=i(e),c=i(r),d=i(t),o=function(){var e=c.default(d.default.mark((function e(r,t){return d.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.fetchDataByChunks({path:"corva/data.mud",queryParams:r,chunkSize:a.CHUNK_SIZE,signal:t,fetcher:function(){var e=c.default(d.default.mark((function e(r,t){var a,n,i,c;return d.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=r.split("/"),n=s.default(a,2),i=n[0],c=n[1],e.abrupt("return",u.getDataAppStorageAggregate(i,c,t));case 2:case"end":return e.stop()}}),e)})));return function(r,t){return e.apply(this,arguments)}}()}));case 1:case"end":return e.stop()}}),e)})));return function(r,t){return e.apply(this,arguments)}}();exports.buildMudQueryParams=function(e,r){var t={company_id:e,asset_id:{$in:r}};return{match:JSON.stringify(t),sort:JSON.stringify({timestamp:-1}),group:JSON.stringify({_id:"$asset_id",doc:{$first:"$$ROOT"}}),project:JSON.stringify({_id:0,"data.key":{$literal:"mud_type"},"data.value":"$doc.data.mud_type",asset_id:"$doc.asset_id"})}},exports.fetchMudAggregate=o;
//# sourceMappingURL=fetchMudAggregate.js.map
