@carto/api-client 0.5.1-alpha.1 → 0.5.1

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
@@ -1,8 +1,13 @@
1
1
  # CHANGELOG
2
2
 
3
- ## 0.5 (Unreleased)
3
+ ## 0.5
4
4
 
5
- ### 0.5.0 (Unreleased)
5
+ ### 0.5.1
6
+
7
+ - chore(types): Cleanup for tilesets, rasters, and backward-compatibility (#150)
8
+ - feat(fetchMap): Export legendSettings (#153)
9
+
10
+ ### 0.5.0
6
11
 
7
12
  - BREAKING CHANGE: Replace 'abortController' with 'signal' parameter (#110)
8
13
  - feat: Add widget calculations for tileset sources (#50)
@@ -5531,6 +5531,7 @@ __export(src_exports, {
5531
5531
  buildPublicMapUrl: () => buildPublicMapUrl,
5532
5532
  buildStatsUrl: () => buildStatsUrl,
5533
5533
  clearFilters: () => clearFilters,
5534
+ configureSource: () => configureSource,
5534
5535
  createPolygonSpatialFilter: () => createPolygonSpatialFilter,
5535
5536
  createViewportSpatialFilter: () => createViewportSpatialFilter,
5536
5537
  fetchBasemapProps: () => fetchBasemapProps,
@@ -5540,12 +5541,14 @@ __export(src_exports, {
5540
5541
  getClient: () => getClient,
5541
5542
  getColorAccessor: () => getColorAccessor,
5542
5543
  getColorValueAccessor: () => getColorValueAccessor,
5544
+ getColumnNameFromGeoColumn: () => getColumnNameFromGeoColumn,
5543
5545
  getDataFilterExtensionProps: () => getDataFilterExtensionProps,
5544
5546
  getFilter: () => getFilter,
5545
5547
  getIconUrlAccessor: () => getIconUrlAccessor,
5546
5548
  getLayerProps: () => getLayerProps,
5547
5549
  getMaxMarkerSize: () => getMaxMarkerSize,
5548
5550
  getSizeAccessor: () => getSizeAccessor,
5551
+ getSpatialIndexFromGeoColumn: () => getSpatialIndexFromGeoColumn,
5549
5552
  getTextAccessor: () => getTextAccessor,
5550
5553
  groupValuesByColumn: () => groupValuesByColumn,
5551
5554
  groupValuesByDateColumn: () => groupValuesByDateColumn,
@@ -5565,6 +5568,7 @@ __export(src_exports, {
5565
5568
  rasterSource: () => rasterSource,
5566
5569
  removeFilter: () => removeFilter,
5567
5570
  requestWithParameters: () => requestWithParameters,
5571
+ scaleAggregationResLevel: () => scaleAggregationResLevel,
5568
5572
  scatterPlot: () => scatterPlot,
5569
5573
  setClient: () => setClient,
5570
5574
  tileFeatures: () => tileFeatures,
@@ -11148,6 +11152,16 @@ function isEmptyObject(object) {
11148
11152
  }
11149
11153
  var isObject2 = (x) => x !== null && typeof x === "object";
11150
11154
  var isPureObject = (x) => isObject2(x) && x.constructor === {}.constructor;
11155
+ function assignOptional(target, ...sources) {
11156
+ for (const source of sources) {
11157
+ for (const key in source) {
11158
+ if (source[key] !== void 0) {
11159
+ target[key] = source[key];
11160
+ }
11161
+ }
11162
+ }
11163
+ return target;
11164
+ }
11151
11165
 
11152
11166
  // src/filters/tileFeatures.ts
11153
11167
  function tileFeatures({
@@ -11491,7 +11505,6 @@ function excludeURLParameters(baseUrlString, parameters) {
11491
11505
  // src/sources/base-source.ts
11492
11506
  var SOURCE_DEFAULTS = {
11493
11507
  apiBaseUrl: DEFAULT_API_BASE_URL,
11494
- format: "tilejson",
11495
11508
  headers: {},
11496
11509
  maxLengthURL: DEFAULT_MAX_LENGTH_URL
11497
11510
  };
@@ -11510,7 +11523,7 @@ async function baseSource(endpoint, options, urlParameters) {
11510
11523
  }
11511
11524
  }
11512
11525
  const baseUrl = buildSourceUrl(mergedOptions);
11513
- const { clientId, maxLengthURL, format, localCache } = mergedOptions;
11526
+ const { clientId, maxLengthURL, localCache } = mergedOptions;
11514
11527
  const headers = {
11515
11528
  Authorization: `Bearer ${options.accessToken}`,
11516
11529
  ...options.headers
@@ -11530,7 +11543,7 @@ async function baseSource(endpoint, options, urlParameters) {
11530
11543
  maxLengthURL,
11531
11544
  localCache
11532
11545
  });
11533
- const dataUrl = mapInstantiation[format].url[0];
11546
+ const dataUrl = mapInstantiation.tilejson.url[0];
11534
11547
  if (cache) {
11535
11548
  cache.value = parseInt(
11536
11549
  new URL(dataUrl).searchParams.get("cache") || "",
@@ -11538,21 +11551,7 @@ async function baseSource(endpoint, options, urlParameters) {
11538
11551
  );
11539
11552
  }
11540
11553
  errorContext.requestType = "Map data";
11541
- if (format === "tilejson") {
11542
- const json = await requestWithParameters({
11543
- baseUrl: dataUrl,
11544
- parameters: { client: clientId },
11545
- headers,
11546
- errorContext,
11547
- maxLengthURL,
11548
- localCache
11549
- });
11550
- if (accessToken) {
11551
- json.accessToken = accessToken;
11552
- }
11553
- return json;
11554
- }
11555
- return await requestWithParameters({
11554
+ const json = await requestWithParameters({
11556
11555
  baseUrl: dataUrl,
11557
11556
  parameters: { client: clientId },
11558
11557
  headers,
@@ -11560,6 +11559,10 @@ async function baseSource(endpoint, options, urlParameters) {
11560
11559
  maxLengthURL,
11561
11560
  localCache
11562
11561
  });
11562
+ if (accessToken) {
11563
+ json.accessToken = accessToken;
11564
+ }
11565
+ return json;
11563
11566
  }
11564
11567
 
11565
11568
  // src/sources/boundary-query-source.ts
@@ -11585,11 +11588,7 @@ var boundaryQuerySource = async function(options) {
11585
11588
  if (queryParameters) {
11586
11589
  urlParameters.queryParameters = queryParameters;
11587
11590
  }
11588
- return baseSource(
11589
- "boundary",
11590
- options,
11591
- urlParameters
11592
- );
11591
+ return baseSource("boundary", options, urlParameters);
11593
11592
  };
11594
11593
 
11595
11594
  // src/sources/boundary-table-source.ts
@@ -11606,11 +11605,7 @@ var boundaryTableSource = async function(options) {
11606
11605
  if (filters) {
11607
11606
  urlParameters.filters = filters;
11608
11607
  }
11609
- return baseSource(
11610
- "boundary",
11611
- options,
11612
- urlParameters
11613
- );
11608
+ return baseSource("boundary", options, urlParameters);
11614
11609
  };
11615
11610
 
11616
11611
  // src/sources/h3-query-source.ts
@@ -12746,8 +12741,7 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
12746
12741
  return;
12747
12742
  }
12748
12743
  this._features = tileFeatures({
12749
- ...this.props,
12750
- ...this._tileFeatureExtractOptions,
12744
+ ...assignOptional({}, this.props, this._tileFeatureExtractOptions),
12751
12745
  tiles: this._tiles,
12752
12746
  spatialFilter
12753
12747
  });
@@ -12900,6 +12894,9 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
12900
12894
  return { rows: [], totalCount: 0 };
12901
12895
  }
12902
12896
  if (searchFilterColumn && searchFilterText) {
12897
+ console.warn(
12898
+ 'WidgetTilesetSource: "searchFilterText" is deprecated, use "filters" and FilterType.STRING_SEARCH instead.'
12899
+ );
12903
12900
  filteredFeatures = filteredFeatures.filter(
12904
12901
  (row) => row[searchFilterColumn] && String(row[searchFilterColumn]).toLowerCase().includes(String(searchFilterText).toLowerCase())
12905
12902
  );
@@ -14747,7 +14744,7 @@ function parseMap(json) {
14747
14744
  const { keplerMapConfig, datasets, token } = json;
14748
14745
  assert2(keplerMapConfig.version === "v1", "Only support Kepler v1");
14749
14746
  const config2 = keplerMapConfig.config;
14750
- const { filters, mapState, mapStyle, popupSettings } = config2;
14747
+ const { filters, mapState, mapStyle, popupSettings, legendSettings } = config2;
14751
14748
  const { layers, layerBlending, interactionConfig } = config2.visState;
14752
14749
  return {
14753
14750
  id: json.id,
@@ -14759,6 +14756,7 @@ function parseMap(json) {
14759
14756
  /** @deprecated Use `basemap`. */
14760
14757
  mapStyle,
14761
14758
  popupSettings,
14759
+ legendSettings,
14762
14760
  token,
14763
14761
  layers: layers.reverse().map(({ id, type, config: config3, visualChannels }) => {
14764
14762
  try {
@@ -15713,6 +15711,7 @@ function _getHexagonResolution(viewport, tileSize) {
15713
15711
  buildPublicMapUrl,
15714
15712
  buildStatsUrl,
15715
15713
  clearFilters,
15714
+ configureSource,
15716
15715
  createPolygonSpatialFilter,
15717
15716
  createViewportSpatialFilter,
15718
15717
  fetchBasemapProps,
@@ -15722,12 +15721,14 @@ function _getHexagonResolution(viewport, tileSize) {
15722
15721
  getClient,
15723
15722
  getColorAccessor,
15724
15723
  getColorValueAccessor,
15724
+ getColumnNameFromGeoColumn,
15725
15725
  getDataFilterExtensionProps,
15726
15726
  getFilter,
15727
15727
  getIconUrlAccessor,
15728
15728
  getLayerProps,
15729
15729
  getMaxMarkerSize,
15730
15730
  getSizeAccessor,
15731
+ getSpatialIndexFromGeoColumn,
15731
15732
  getTextAccessor,
15732
15733
  groupValuesByColumn,
15733
15734
  groupValuesByDateColumn,
@@ -15747,6 +15748,7 @@ function _getHexagonResolution(viewport, tileSize) {
15747
15748
  rasterSource,
15748
15749
  removeFilter,
15749
15750
  requestWithParameters,
15751
+ scaleAggregationResLevel,
15750
15752
  scatterPlot,
15751
15753
  setClient,
15752
15754
  tileFeatures,