import r from"@babel/runtime/helpers/slicedToArray";import t from"@babel/runtime/helpers/asyncToGenerator";import e from"@babel/runtime/regenerator";import{CHUNK_SIZE as a}from"../shared/constants.js";import{fetchDataByChunks as n}from"../shared/fetchers/fetchDataByChunks.js";import{getDataAppStorageAggregate as i}from"../../../../clients/jsonApi/index.js";var s=function(r,t,e){var a={company_id:r,"data.asset_id":{$in:t},"data.key":{$in:e},"data.type":"asset"};return{match:JSON.stringify(a),project:JSON.stringify({_id:0,"data.key":1,"data.value":1,asset_id:"$data.asset_id"}),sort:JSON.stringify({timestamp:-1})}},o=function(){var s=t(e.mark((function s(o,u){var c,p=arguments;return e.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return c=p.length>2&&void 0!==p[2]?p[2]:"corva/metrics",s.abrupt("return",n({path:c,queryParams:o,chunkSize:a,signal:u,fetcher:function(){var a=t(e.mark((function t(a,n){var s,o,u,c;return e.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=a.split("/"),o=r(s,2),u=o[0],c=o[1],t.abrupt("return",i(u,c,n));case 2:case"end":return t.stop()}}),t)})));return function(r,t){return a.apply(this,arguments)}}()}));case 2:case"end":return s.stop()}}),s)})));return function(r,t){return s.apply(this,arguments)}}();export{s as buildMetricsQueryParams,o as fetchMetricsAggregate};
//# sourceMappingURL=fetchMetricsAggregate.js.map
