@carto/api-client 0.5.9-alpha.PR193.3 → 0.5.9
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/CHANGELOG.md +4 -0
- package/build/api-client.cjs +47 -33
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +14 -18
- package/build/api-client.d.ts +14 -18
- package/build/api-client.js +46 -33
- package/build/api-client.js.map +1 -1
- package/build/worker-compat.js +21 -3
- package/build/worker-compat.js.map +1 -1
- package/build/worker.js +21 -3
- package/build/worker.js.map +1 -1
- package/package.json +1 -1
- package/src/api/query.ts +2 -19
- package/src/api/request-with-parameters.ts +5 -10
- package/src/models/model.ts +0 -3
- package/src/operations/groupBy.ts +31 -2
- package/src/sources/base-source.ts +1 -1
- package/src/sources/types.ts +0 -3
- package/src/widget-sources/types.ts +12 -0
- package/src/widget-sources/widget-remote-source.ts +9 -3
- package/src/widget-sources/widget-tileset-source-impl.ts +2 -0
package/build/worker-compat.js
CHANGED
|
@@ -20073,7 +20073,8 @@
|
|
|
20073
20073
|
joinOperation,
|
|
20074
20074
|
keysColumn,
|
|
20075
20075
|
operation: operation2,
|
|
20076
|
-
othersThreshold
|
|
20076
|
+
othersThreshold,
|
|
20077
|
+
orderBy = "frequency_desc"
|
|
20077
20078
|
}) {
|
|
20078
20079
|
if (Array.isArray(data) && data.length === 0) {
|
|
20079
20080
|
return { rows: null };
|
|
@@ -20097,7 +20098,7 @@
|
|
|
20097
20098
|
const allCategories = Array.from(groups).map(([name, value]) => ({
|
|
20098
20099
|
name,
|
|
20099
20100
|
value: targetOperation(value)
|
|
20100
|
-
})).sort((
|
|
20101
|
+
})).sort(getSorter(orderBy));
|
|
20101
20102
|
if (othersThreshold && allCategories.length > othersThreshold) {
|
|
20102
20103
|
const otherValue = allCategories.slice(othersThreshold).flatMap(({ name }) => groups.get(name));
|
|
20103
20104
|
return {
|
|
@@ -20111,6 +20112,21 @@
|
|
|
20111
20112
|
rows: allCategories
|
|
20112
20113
|
};
|
|
20113
20114
|
}
|
|
20115
|
+
function getSorter(orderBy) {
|
|
20116
|
+
switch (orderBy) {
|
|
20117
|
+
case "frequency_asc":
|
|
20118
|
+
return (a, b) => a.value - b.value || localeCompare(a.name, b.name);
|
|
20119
|
+
case "frequency_desc":
|
|
20120
|
+
return (a, b) => b.value - a.value || localeCompare(a.name, b.name);
|
|
20121
|
+
case "alphabetical_asc":
|
|
20122
|
+
return (a, b) => localeCompare(a.name, b.name) || b.value - a.value;
|
|
20123
|
+
case "alphabetical_desc":
|
|
20124
|
+
return (a, b) => localeCompare(b.name, a.name) || b.value - a.value;
|
|
20125
|
+
}
|
|
20126
|
+
}
|
|
20127
|
+
function localeCompare(a, b) {
|
|
20128
|
+
return (a ?? "null").localeCompare(b ?? "null");
|
|
20129
|
+
}
|
|
20114
20130
|
|
|
20115
20131
|
// src/utils/dateUtils.ts
|
|
20116
20132
|
function getUTCMonday(date) {
|
|
@@ -20733,6 +20749,7 @@
|
|
|
20733
20749
|
filterOwner,
|
|
20734
20750
|
spatialFilter,
|
|
20735
20751
|
othersThreshold,
|
|
20752
|
+
orderBy = "frequency_desc",
|
|
20736
20753
|
rawResult
|
|
20737
20754
|
}) {
|
|
20738
20755
|
const filteredFeatures = this._getFilteredFeatures(
|
|
@@ -20750,7 +20767,8 @@
|
|
|
20750
20767
|
joinOperation,
|
|
20751
20768
|
keysColumn: column,
|
|
20752
20769
|
operation: operation2,
|
|
20753
|
-
othersThreshold
|
|
20770
|
+
othersThreshold,
|
|
20771
|
+
orderBy
|
|
20754
20772
|
});
|
|
20755
20773
|
if (rawResult) {
|
|
20756
20774
|
return result;
|