@gen3/core 0.10.97 → 0.10.98

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 CHANGED
@@ -831,7 +831,8 @@ const newCohort = ({ filters = {}, customName })=>{
831
831
  filters: filters ?? {},
832
832
  modified: false,
833
833
  saved: false,
834
- modified_datetime: ts.toISOString()
834
+ modified_datetime: ts.toISOString(),
835
+ counts: {}
835
836
  };
836
837
  };
837
838
  const createCohortId = ()=>toolkit.nanoid();
@@ -1505,6 +1506,22 @@ const fetchFencePresignedURL = async ({ guid, method = 'GET', onAbort = ()=>null
1505
1506
  return await response.json();
1506
1507
  };
1507
1508
 
1509
+ /**
1510
+ * Converts HistogramData to HistogramDataAsStringKey by ensuring the key is a string.
1511
+ * If the key is already a string, it's used as is.
1512
+ * If the key is a number tuple [min, max], it's converted to a string in the format "min-max".
1513
+ *
1514
+ * @param data The HistogramData object to convert
1515
+ * @returns HistogramDataAsStringKey with the converted key
1516
+ */ const convertToHistogramDataAsStringKey = (data)=>{
1517
+ return {
1518
+ key: typeof data.key === 'string' ? data.key : `${data.key[0]}-${data.key[1]}`,
1519
+ count: data.count
1520
+ };
1521
+ };
1522
+ const calculatePercentageAsNumber = (count, total)=>count ? count / total * 100 : 0;
1523
+ const calculatePercentageAsString = (count, total)=>`${(count / total * 100).toFixed(2)}%`;
1524
+
1508
1525
  const queryWTSFederatedLoginStatus = async (signal)=>{
1509
1526
  try {
1510
1527
  const results = await fetchJSONDataFromURL(`${GEN3_WTS_API}/external_oidc/`, false, HttpMethod.GET, undefined, signal);
@@ -4872,11 +4889,14 @@ exports.WorkspaceStatus = WorkspaceStatus;
4872
4889
  exports.addNewDefaultUnsavedCohort = addNewDefaultUnsavedCohort;
4873
4890
  exports.buildGetAggregationQuery = buildGetAggregationQuery;
4874
4891
  exports.buildListItemsGroupedByDataset = buildListItemsGroupedByDataset;
4892
+ exports.calculatePercentageAsNumber = calculatePercentageAsNumber;
4893
+ exports.calculatePercentageAsString = calculatePercentageAsString;
4875
4894
  exports.clearActiveWorkspaceId = clearActiveWorkspaceId;
4876
4895
  exports.clearCohortFilters = clearCohortFilters;
4877
4896
  exports.cohortReducer = cohortReducer;
4878
4897
  exports.convertFilterSetToGqlFilter = convertFilterSetToGqlFilter;
4879
4898
  exports.convertFilterToGqlFilter = convertFilterToGqlFilter;
4899
+ exports.convertToHistogramDataAsStringKey = convertToHistogramDataAsStringKey;
4880
4900
  exports.convertToQueryString = convertToQueryString;
4881
4901
  exports.coreStore = coreStore;
4882
4902
  exports.createAppApiForRTKQ = createAppApiForRTKQ;