"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),t=require("@babel/runtime/helpers/asyncToGenerator"),r=require("@babel/runtime/regenerator"),a=require("../shared/constants.js"),n=require("../shared/fetchers/fetchDataByChunks.js"),s=require("../../../../clients/jsonApi/index.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=u(e),c=u(t),o=u(r),f=function(){var e=c.default(o.default.mark((function e(t,r){var u,f=arguments;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=f.length>2&&void 0!==f[2]?f[2]:"corva/metrics",e.abrupt("return",n.fetchDataByChunks({path:u,queryParams:t,chunkSize:a.CHUNK_SIZE,signal:r,fetcher:function(){var e=c.default(o.default.mark((function e(t,r){var a,n,u,c;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=t.split("/"),n=i.default(a,2),u=n[0],c=n[1],e.abrupt("return",s.getDataAppStorageAggregate(u,c,r));case 2:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()}));case 2:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}();exports.buildMetricsQueryParams=function(e,t,r){var a={company_id:e,"data.asset_id":{$in:t},"data.key":{$in:r},"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})}},exports.fetchMetricsAggregate=f;
//# sourceMappingURL=fetchMetricsAggregate.js.map
