@carto/api-client 0.5.28 → 0.5.29

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 CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ### 0.5.29
6
+
7
+ - feat(sources): Support featureBbox parameter (#289)
8
+
5
9
  ### 0.5.28
6
10
 
7
11
  - feat(fetchMap): Support zoom-dependent point styling (#287)
@@ -8564,7 +8564,8 @@ var vectorQuerySource = async function(options) {
8564
8564
  sqlQuery,
8565
8565
  tileResolution = DEFAULT_TILE_RESOLUTION,
8566
8566
  queryParameters,
8567
- aggregationExp
8567
+ aggregationExp,
8568
+ featureBbox
8568
8569
  } = options;
8569
8570
  const spatialDataType = "geo";
8570
8571
  const urlParameters = {
@@ -8585,6 +8586,9 @@ var vectorQuerySource = async function(options) {
8585
8586
  if (aggregationExp) {
8586
8587
  urlParameters.aggregationExp = aggregationExp;
8587
8588
  }
8589
+ if (featureBbox) {
8590
+ urlParameters.featureBbox = true;
8591
+ }
8588
8592
  return baseSource("query", options, urlParameters).then(
8589
8593
  (result) => ({
8590
8594
  ...result,
@@ -8608,7 +8612,8 @@ var vectorTableSource = async function(options) {
8608
8612
  spatialDataColumn = DEFAULT_GEO_COLUMN,
8609
8613
  tableName,
8610
8614
  tileResolution = DEFAULT_TILE_RESOLUTION,
8611
- aggregationExp
8615
+ aggregationExp,
8616
+ featureBbox
8612
8617
  } = options;
8613
8618
  const spatialDataType = "geo";
8614
8619
  const urlParameters = {
@@ -8626,6 +8631,9 @@ var vectorTableSource = async function(options) {
8626
8631
  if (aggregationExp) {
8627
8632
  urlParameters.aggregationExp = aggregationExp;
8628
8633
  }
8634
+ if (featureBbox) {
8635
+ urlParameters.featureBbox = true;
8636
+ }
8629
8637
  return baseSource("table", options, urlParameters).then(
8630
8638
  (result) => ({
8631
8639
  ...result,
@@ -11216,11 +11224,13 @@ function configureSource({
11216
11224
  tileResolution,
11217
11225
  ...queryParameters && { queryParameters }
11218
11226
  };
11227
+ const { featureBbox } = dataset;
11219
11228
  const vectorOptions = {
11220
11229
  spatialDataColumn,
11221
11230
  ...columns && { columns },
11222
11231
  ...filters && { filters },
11223
- ...aggregationExp && { aggregationExp }
11232
+ ...aggregationExp && { aggregationExp },
11233
+ ...featureBbox && { featureBbox }
11224
11234
  };
11225
11235
  if (type === "raster") {
11226
11236
  return rasterSource({
@@ -11504,6 +11514,21 @@ async function fetchMap({
11504
11514
  }
11505
11515
  }
11506
11516
  });
11517
+ const layers = map.keplerMapConfig.config.visState.layers;
11518
+ const datasetsWithLabels = /* @__PURE__ */ new Set();
11519
+ for (const layer of layers) {
11520
+ const hasTextLabel = layer.config?.textLabel?.some(
11521
+ (t) => t.field?.name
11522
+ );
11523
+ if (hasTextLabel) {
11524
+ datasetsWithLabels.add(layer.config.dataId);
11525
+ }
11526
+ }
11527
+ map.datasets.forEach((dataset) => {
11528
+ if (datasetsWithLabels.has(dataset.id) && (dataset.type === "table" || dataset.type === "query")) {
11529
+ dataset.featureBbox = true;
11530
+ }
11531
+ });
11507
11532
  const [basemap] = await Promise.all([
11508
11533
  fetchBasemapProps({ config: map.keplerMapConfig.config, errorContext }),
11509
11534
  // Mutates map.datasets so that dataset.data contains data