@carto/api-client 0.5.30-alpha.143d135.117 → 0.5.30-alpha.b195e7f.118
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 +1 -0
- package/build/api-client.cjs +27 -8
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +24 -2
- package/build/api-client.d.ts +24 -2
- package/build/api-client.js +27 -8
- package/build/api-client.js.map +1 -1
- package/package.json +1 -1
- package/src/widget-sources/types.ts +24 -1
- package/src/widget-sources/widget-remote-source.ts +34 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
### 0.5.30
|
|
6
6
|
|
|
7
|
+
- feat(widgetSources): support `featureIds` / `geometryType` request options to filter widget aggregations by a feature selection without relying on the synthetic `_carto_feature_id` column (#294)
|
|
7
8
|
- feat(widgetSources): support `SpatialIndexFilter` (H3/Quadbin cell selection) on `spatialFilter` (#296)
|
|
8
9
|
|
|
9
10
|
### 0.5.29
|
package/build/api-client.cjs
CHANGED
|
@@ -6594,6 +6594,19 @@ init_cjs_shims();
|
|
|
6594
6594
|
var OTHERS_CATEGORY_NAME = "_carto_others";
|
|
6595
6595
|
|
|
6596
6596
|
// src/widget-sources/widget-remote-source.ts
|
|
6597
|
+
var FEATURE_IDS_LIMIT = 1e3;
|
|
6598
|
+
function getFeatureSelectionParams(options) {
|
|
6599
|
+
const { featureIds, geometryType } = options;
|
|
6600
|
+
if (!featureIds || featureIds.length === 0) {
|
|
6601
|
+
return {};
|
|
6602
|
+
}
|
|
6603
|
+
assert2(geometryType, "geometryType is required when featureIds are provided");
|
|
6604
|
+
assert2(
|
|
6605
|
+
featureIds.length <= FEATURE_IDS_LIMIT,
|
|
6606
|
+
`featureIds is limited to ${FEATURE_IDS_LIMIT} values, received ${featureIds.length}`
|
|
6607
|
+
);
|
|
6608
|
+
return { featureIds, geometryType };
|
|
6609
|
+
}
|
|
6597
6610
|
var WidgetRemoteSource = class extends WidgetSource {
|
|
6598
6611
|
_getModelSource(filters, filterOwner) {
|
|
6599
6612
|
const props = this.props;
|
|
@@ -6644,7 +6657,8 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
6644
6657
|
operationExp,
|
|
6645
6658
|
operationColumn: operationColumn || column,
|
|
6646
6659
|
othersThreshold,
|
|
6647
|
-
orderBy
|
|
6660
|
+
orderBy,
|
|
6661
|
+
...getFeatureSelectionParams(options)
|
|
6648
6662
|
},
|
|
6649
6663
|
opts: { signal, headers: this.props.headers }
|
|
6650
6664
|
});
|
|
@@ -6714,7 +6728,8 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
6714
6728
|
params: {
|
|
6715
6729
|
column: column ?? "*",
|
|
6716
6730
|
operation: operation2 ?? AggregationTypes.Count,
|
|
6717
|
-
operationExp
|
|
6731
|
+
operationExp,
|
|
6732
|
+
...getFeatureSelectionParams(options)
|
|
6718
6733
|
},
|
|
6719
6734
|
opts: { signal, headers: this.props.headers }
|
|
6720
6735
|
}).then((res) => normalizeObjectKeys(res.rows[0]));
|
|
@@ -6736,7 +6751,7 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
6736
6751
|
spatialFiltersMode,
|
|
6737
6752
|
spatialFilter
|
|
6738
6753
|
},
|
|
6739
|
-
params: { column, operation: operation2, ticks },
|
|
6754
|
+
params: { column, operation: operation2, ticks, ...getFeatureSelectionParams(options) },
|
|
6740
6755
|
opts: { signal, headers: this.props.headers }
|
|
6741
6756
|
}).then((res) => normalizeObjectKeys(res.rows));
|
|
6742
6757
|
if (data.length) {
|
|
@@ -6765,7 +6780,7 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
6765
6780
|
spatialFiltersMode,
|
|
6766
6781
|
spatialFilter
|
|
6767
6782
|
},
|
|
6768
|
-
params: { column },
|
|
6783
|
+
params: { column, ...getFeatureSelectionParams(options) },
|
|
6769
6784
|
opts: { signal, headers: this.props.headers }
|
|
6770
6785
|
}).then((res) => normalizeObjectKeys(res.rows[0]));
|
|
6771
6786
|
}
|
|
@@ -6792,7 +6807,8 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
6792
6807
|
xAxisJoinOperation,
|
|
6793
6808
|
yAxisColumn,
|
|
6794
6809
|
yAxisJoinOperation,
|
|
6795
|
-
limit: HARD_LIMIT
|
|
6810
|
+
limit: HARD_LIMIT,
|
|
6811
|
+
...getFeatureSelectionParams(options)
|
|
6796
6812
|
},
|
|
6797
6813
|
opts: { signal, headers: this.props.headers }
|
|
6798
6814
|
}).then((res) => normalizeObjectKeys(res.rows)).then((res) => res.map(({ x, y }) => [x, y]));
|
|
@@ -6819,7 +6835,8 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
6819
6835
|
sortBy,
|
|
6820
6836
|
sortDirection,
|
|
6821
6837
|
limit,
|
|
6822
|
-
offset
|
|
6838
|
+
offset,
|
|
6839
|
+
...getFeatureSelectionParams(options)
|
|
6823
6840
|
},
|
|
6824
6841
|
opts: { signal, headers: this.props.headers }
|
|
6825
6842
|
}).then((res) => ({
|
|
@@ -6869,7 +6886,8 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
6869
6886
|
operationExp,
|
|
6870
6887
|
splitByCategory,
|
|
6871
6888
|
splitByCategoryLimit,
|
|
6872
|
-
splitByCategoryValues
|
|
6889
|
+
splitByCategoryValues,
|
|
6890
|
+
...getFeatureSelectionParams(options)
|
|
6873
6891
|
},
|
|
6874
6892
|
opts: { signal, headers: this.props.headers }
|
|
6875
6893
|
}).then((res) => ({
|
|
@@ -6894,7 +6912,8 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
6894
6912
|
spatialFilter
|
|
6895
6913
|
},
|
|
6896
6914
|
params: {
|
|
6897
|
-
aggregations
|
|
6915
|
+
aggregations,
|
|
6916
|
+
...getFeatureSelectionParams(options)
|
|
6898
6917
|
},
|
|
6899
6918
|
opts: { signal, headers: this.props.headers }
|
|
6900
6919
|
}).then((res) => ({
|