@carto/api-client 0.5.7-alpha.2 → 0.5.7-alpha.3
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/build/api-client.cjs +28 -13
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +6 -5
- package/build/api-client.d.ts +6 -5
- package/build/api-client.js +25 -12
- package/build/api-client.js.map +1 -1
- package/build/worker-compat.js +25 -9
- package/build/worker-compat.js.map +1 -1
- package/build/worker.js +25 -9
- package/build/worker.js.map +1 -1
- package/package.json +1 -1
- package/src/operations/groupBy.ts +24 -6
- package/src/widget-sources/types.ts +3 -3
- package/src/widget-sources/widget-tileset-source-impl.ts +2 -0
package/build/api-client.cjs
CHANGED
|
@@ -6948,12 +6948,19 @@ function normalizeSortByOptions({
|
|
|
6948
6948
|
|
|
6949
6949
|
// src/operations/groupBy.ts
|
|
6950
6950
|
init_cjs_shims();
|
|
6951
|
+
|
|
6952
|
+
// src/widget-sources/constants.ts
|
|
6953
|
+
init_cjs_shims();
|
|
6954
|
+
var OTHERS_CATEGORY_NAME = "_carto_others";
|
|
6955
|
+
|
|
6956
|
+
// src/operations/groupBy.ts
|
|
6951
6957
|
function groupValuesByColumn({
|
|
6952
6958
|
data,
|
|
6953
6959
|
valuesColumns,
|
|
6954
6960
|
joinOperation,
|
|
6955
6961
|
keysColumn,
|
|
6956
|
-
operation: operation2
|
|
6962
|
+
operation: operation2,
|
|
6963
|
+
othersThreshold
|
|
6957
6964
|
}) {
|
|
6958
6965
|
if (Array.isArray(data) && data.length === 0) {
|
|
6959
6966
|
return null;
|
|
@@ -6971,13 +6978,23 @@ function groupValuesByColumn({
|
|
|
6971
6978
|
return accumulator;
|
|
6972
6979
|
}, /* @__PURE__ */ new Map());
|
|
6973
6980
|
const targetOperation = aggregationFunctions[operation2];
|
|
6974
|
-
if (targetOperation) {
|
|
6975
|
-
return
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6981
|
+
if (!targetOperation) {
|
|
6982
|
+
return [];
|
|
6983
|
+
}
|
|
6984
|
+
const allCategories = Array.from(groups).map(([name, value]) => ({
|
|
6985
|
+
name,
|
|
6986
|
+
value: targetOperation(value)
|
|
6987
|
+
}));
|
|
6988
|
+
allCategories.sort((a, b) => b.value - a.value);
|
|
6989
|
+
if (othersThreshold && allCategories.length > othersThreshold) {
|
|
6990
|
+
const otherNames = allCategories.map((entry) => entry.name).slice(othersThreshold);
|
|
6991
|
+
const otherValue = otherNames.flatMap((name) => groups.get(name));
|
|
6992
|
+
allCategories.push({
|
|
6993
|
+
name: OTHERS_CATEGORY_NAME,
|
|
6994
|
+
value: targetOperation(otherValue)
|
|
6995
|
+
});
|
|
6979
6996
|
}
|
|
6980
|
-
return
|
|
6997
|
+
return allCategories;
|
|
6981
6998
|
}
|
|
6982
6999
|
|
|
6983
7000
|
// src/operations/groupByDate.ts
|
|
@@ -7551,7 +7568,8 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
|
|
|
7551
7568
|
joinOperation,
|
|
7552
7569
|
filters,
|
|
7553
7570
|
filterOwner,
|
|
7554
|
-
spatialFilter
|
|
7571
|
+
spatialFilter,
|
|
7572
|
+
othersThreshold
|
|
7555
7573
|
}) {
|
|
7556
7574
|
const filteredFeatures = this._getFilteredFeatures(
|
|
7557
7575
|
spatialFilter,
|
|
@@ -7567,7 +7585,8 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
|
|
|
7567
7585
|
valuesColumns: normalizeColumns(operationColumn || column),
|
|
7568
7586
|
joinOperation,
|
|
7569
7587
|
keysColumn: column,
|
|
7570
|
-
operation: operation2
|
|
7588
|
+
operation: operation2,
|
|
7589
|
+
othersThreshold
|
|
7571
7590
|
});
|
|
7572
7591
|
return groups || [];
|
|
7573
7592
|
}
|
|
@@ -7942,10 +7961,6 @@ var WidgetTableSource = class extends WidgetRemoteSource {
|
|
|
7942
7961
|
}
|
|
7943
7962
|
};
|
|
7944
7963
|
|
|
7945
|
-
// src/widget-sources/constants.ts
|
|
7946
|
-
init_cjs_shims();
|
|
7947
|
-
var OTHERS_CATEGORY_NAME = "_carto_others";
|
|
7948
|
-
|
|
7949
7964
|
// src/sources/h3-query-source.ts
|
|
7950
7965
|
var h3QuerySource = async function(options) {
|
|
7951
7966
|
const {
|