@gen3/core 0.11.24 → 0.11.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +98 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/dts/features/guppy/guppySlice.d.ts +375 -1
- package/dist/dts/features/guppy/guppySlice.d.ts.map +1 -1
- package/dist/dts/features/guppy/processing.d.ts +3 -3
- package/dist/dts/features/guppy/processing.d.ts.map +1 -1
- package/dist/dts/types/index.d.ts +16 -0
- package/dist/dts/types/index.d.ts.map +1 -1
- package/dist/esm/index.js +93 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +396 -4
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -1656,6 +1656,49 @@ const isGuppyAggregationData = (obj)=>{
|
|
|
1656
1656
|
const isHistogramDataAnEnum = (data)=>{
|
|
1657
1657
|
return typeof data === 'object' && data !== null && 'key' in data && 'count' in data && typeof data.key === 'string' && typeof data.count === 'number';
|
|
1658
1658
|
};
|
|
1659
|
+
const isStatsValue = (item)=>{
|
|
1660
|
+
if (typeof item !== 'object' || item === null) {
|
|
1661
|
+
return false;
|
|
1662
|
+
}
|
|
1663
|
+
const obj = item;
|
|
1664
|
+
// Check that all present properties have correct types
|
|
1665
|
+
const numericFields = [
|
|
1666
|
+
'count',
|
|
1667
|
+
'min',
|
|
1668
|
+
'max',
|
|
1669
|
+
'avg',
|
|
1670
|
+
'sum',
|
|
1671
|
+
'stddev',
|
|
1672
|
+
'median'
|
|
1673
|
+
];
|
|
1674
|
+
for (const field of numericFields){
|
|
1675
|
+
if (field in obj && typeof obj[field] !== 'number') {
|
|
1676
|
+
return false;
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
// Check percentiles structure if present
|
|
1680
|
+
if ('percentiles' in obj) {
|
|
1681
|
+
const percentiles = obj.percentiles;
|
|
1682
|
+
if (typeof percentiles !== 'object' || percentiles === null) {
|
|
1683
|
+
return false;
|
|
1684
|
+
}
|
|
1685
|
+
const pObj = percentiles;
|
|
1686
|
+
const requiredPercentiles = [
|
|
1687
|
+
'p25',
|
|
1688
|
+
'p50',
|
|
1689
|
+
'p75'
|
|
1690
|
+
];
|
|
1691
|
+
for (const p of requiredPercentiles){
|
|
1692
|
+
if (p in pObj && typeof pObj[p] !== 'number') {
|
|
1693
|
+
return false;
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
return true;
|
|
1698
|
+
};
|
|
1699
|
+
const isStatsValuesArray = (data)=>{
|
|
1700
|
+
return Array.isArray(data) && data.every(isStatsValue);
|
|
1701
|
+
};
|
|
1659
1702
|
const isHistogramDataAArray = (data)=>{
|
|
1660
1703
|
return Array.isArray(data) && data.every(isHistogramData);
|
|
1661
1704
|
};
|
|
@@ -4359,6 +4402,14 @@ const useGetStatus = ()=>{
|
|
|
4359
4402
|
return processHistogramResponse(response?.data?._aggregation[args.type] ?? {});
|
|
4360
4403
|
}
|
|
4361
4404
|
}),
|
|
4405
|
+
getStatsAggregations: builder.query({
|
|
4406
|
+
query: ({ type, fields, filters, accessibility = Accessibility.ALL, filterSelf = false })=>{
|
|
4407
|
+
return buildGetStatsAggregationQuery(type, fields, filters, accessibility, filterSelf);
|
|
4408
|
+
},
|
|
4409
|
+
transformResponse: (response, _meta, args)=>{
|
|
4410
|
+
return processHistogramResponse(response?.data?._aggregation[args.type] ?? {});
|
|
4411
|
+
}
|
|
4412
|
+
}),
|
|
4362
4413
|
getSubAggs: builder.query({
|
|
4363
4414
|
query: ({ type, mainField, termsFields = undefined, missingFields = undefined, numericAggAsText = false, gqlFilter = undefined, accessibility = Accessibility.ALL })=>{
|
|
4364
4415
|
const nestedAggFields = {
|
|
@@ -4494,6 +4545,26 @@ const histogramQueryStrForEachField = (field)=>{
|
|
|
4494
4545
|
${histogramQueryStrForEachField(splittedFieldArray.join('.'))}
|
|
4495
4546
|
}`;
|
|
4496
4547
|
};
|
|
4548
|
+
const statsQueryStrForEachField = (field)=>{
|
|
4549
|
+
const splittedFieldArray = field.split('.');
|
|
4550
|
+
const splittedField = splittedFieldArray.shift();
|
|
4551
|
+
if (splittedFieldArray.length === 0) {
|
|
4552
|
+
return `
|
|
4553
|
+
${splittedField} {
|
|
4554
|
+
histogram {
|
|
4555
|
+
count
|
|
4556
|
+
min
|
|
4557
|
+
max
|
|
4558
|
+
avg
|
|
4559
|
+
sum
|
|
4560
|
+
}
|
|
4561
|
+
}`;
|
|
4562
|
+
}
|
|
4563
|
+
return `
|
|
4564
|
+
${splittedField} {
|
|
4565
|
+
${statsQueryStrForEachField(splittedFieldArray.join('.'))}
|
|
4566
|
+
}`;
|
|
4567
|
+
};
|
|
4497
4568
|
const nestedHistogramQueryStrForEachField = (mainField, numericAggAsText)=>`
|
|
4498
4569
|
${mainField} {
|
|
4499
4570
|
${numericAggAsText ? 'asTextHistogram' : 'histogram'} {
|
|
@@ -4559,7 +4630,27 @@ const buildGetAggregationQuery = (type, fields, filters, accessibility = Accessi
|
|
|
4559
4630
|
};
|
|
4560
4631
|
return queryBody;
|
|
4561
4632
|
};
|
|
4562
|
-
const
|
|
4633
|
+
const buildGetStatsAggregationQuery = (type, fields, filters, accessibility = Accessibility.ALL, filterSelf = false)=>{
|
|
4634
|
+
const queryStart = isFilterEmpty(filters) ? `
|
|
4635
|
+
query getAggs {
|
|
4636
|
+
_aggregation {
|
|
4637
|
+
${type} (accessibility: ${accessibility}) {` : `query getAggs ($filter: JSON) {
|
|
4638
|
+
_aggregation {
|
|
4639
|
+
${type} (filter: $filter, filterSelf: ${filterSelf ? 'true' : 'false'}, accessibility: ${accessibility}) {`;
|
|
4640
|
+
const query = `${queryStart}
|
|
4641
|
+
${fields.map((field)=>statsQueryStrForEachField(field))}
|
|
4642
|
+
}
|
|
4643
|
+
}
|
|
4644
|
+
}`;
|
|
4645
|
+
const queryBody = {
|
|
4646
|
+
query: query,
|
|
4647
|
+
variables: {
|
|
4648
|
+
filter: convertFilterSetToGqlFilter(filters)
|
|
4649
|
+
}
|
|
4650
|
+
};
|
|
4651
|
+
return queryBody;
|
|
4652
|
+
};
|
|
4653
|
+
const { useGetRawDataAndTotalCountsQuery, useGetAccessibleDataQuery, useGetAllFieldsForTypeQuery, useGetAggsQuery, useGetAggsNoFilterSelfQuery, useLazyGetAggsQuery, useLazyGetAggsNoFilterSelfQuery, useGetStatsAggregationsQuery, useLazyGetStatsAggregationsQuery, useGetSubAggsQuery, useGetCountsQuery, useGetFieldCountSummaryQuery, useGetFieldsForIndexQuery, useGetSharedFieldsForIndexQuery, useGeneralGQLQuery, useLazyGeneralGQLQuery } = explorerApi;
|
|
4563
4654
|
|
|
4564
4655
|
/**
|
|
4565
4656
|
* Creates a Guppy API for fetching bulk (> 10K rows) elasticsearch data
|
|
@@ -5478,6 +5569,7 @@ exports.ValueExtractorHandler = ValueExtractorHandler;
|
|
|
5478
5569
|
exports.WorkspaceStatus = WorkspaceStatus;
|
|
5479
5570
|
exports.appendFilterToOperation = appendFilterToOperation;
|
|
5480
5571
|
exports.buildGetAggregationQuery = buildGetAggregationQuery;
|
|
5572
|
+
exports.buildGetStatsAggregationQuery = buildGetStatsAggregationQuery;
|
|
5481
5573
|
exports.buildListItemsGroupedByDataset = buildListItemsGroupedByDataset;
|
|
5482
5574
|
exports.calculatePercentageAsNumber = calculatePercentageAsNumber;
|
|
5483
5575
|
exports.calculatePercentageAsString = calculatePercentageAsString;
|
|
@@ -5574,6 +5666,8 @@ exports.isOperatorWithFieldAndArrayOfOperands = isOperatorWithFieldAndArrayOfOpe
|
|
|
5574
5666
|
exports.isPending = isPending;
|
|
5575
5667
|
exports.isProgramUrl = isProgramUrl;
|
|
5576
5668
|
exports.isRootUrl = isRootUrl;
|
|
5669
|
+
exports.isStatsValue = isStatsValue;
|
|
5670
|
+
exports.isStatsValuesArray = isStatsValuesArray;
|
|
5577
5671
|
exports.isString = isString;
|
|
5578
5672
|
exports.isTimeGreaterThan = isTimeGreaterThan;
|
|
5579
5673
|
exports.isUnion = isUnion;
|
|
@@ -5648,6 +5742,7 @@ exports.setSharedFilters = setSharedFilters;
|
|
|
5648
5742
|
exports.setShouldShareFilters = setShouldShareFilters;
|
|
5649
5743
|
exports.setupCoreStore = setupCoreStore;
|
|
5650
5744
|
exports.showModal = showModal;
|
|
5745
|
+
exports.statsQueryStrForEachField = statsQueryStrForEachField;
|
|
5651
5746
|
exports.submissionApi = submissionApi;
|
|
5652
5747
|
exports.toggleCohortBuilderAllFilters = toggleCohortBuilderAllFilters;
|
|
5653
5748
|
exports.toggleCohortBuilderCategoryFilter = toggleCohortBuilderCategoryFilter;
|
|
@@ -5711,6 +5806,7 @@ exports.useGetSowerJobListQuery = useGetSowerJobListQuery;
|
|
|
5711
5806
|
exports.useGetSowerJobStatusQuery = useGetSowerJobStatusQuery;
|
|
5712
5807
|
exports.useGetSowerOutputQuery = useGetSowerOutputQuery;
|
|
5713
5808
|
exports.useGetSowerServiceStatusQuery = useGetSowerServiceStatusQuery;
|
|
5809
|
+
exports.useGetStatsAggregationsQuery = useGetStatsAggregationsQuery;
|
|
5714
5810
|
exports.useGetStatus = useGetStatus;
|
|
5715
5811
|
exports.useGetSubAggsQuery = useGetSubAggsQuery;
|
|
5716
5812
|
exports.useGetSubmissionGraphQLQuery = useGetSubmissionGraphQLQuery;
|
|
@@ -5736,6 +5832,7 @@ exports.useLazyGetExternalLoginsQuery = useLazyGetExternalLoginsQuery;
|
|
|
5736
5832
|
exports.useLazyGetManifestServiceStatusQuery = useLazyGetManifestServiceStatusQuery;
|
|
5737
5833
|
exports.useLazyGetProjectsQuery = useLazyGetProjectsQuery;
|
|
5738
5834
|
exports.useLazyGetSowerJobListQuery = useLazyGetSowerJobListQuery;
|
|
5835
|
+
exports.useLazyGetStatsAggregationsQuery = useLazyGetStatsAggregationsQuery;
|
|
5739
5836
|
exports.useLazyGetSubmissionGraphQLQuery = useLazyGetSubmissionGraphQLQuery;
|
|
5740
5837
|
exports.useLazyIsExternalConnectedQuery = useLazyIsExternalConnectedQuery;
|
|
5741
5838
|
exports.useLazyRequestQuery = useLazyRequestQuery;
|