@carto/api-client 0.5.2-alpha.0 → 0.5.2-alpha.2

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.
Files changed (65) hide show
  1. package/build/api-client.cjs +125 -14
  2. package/build/api-client.cjs.map +1 -1
  3. package/build/api-client.d.cts +47 -1
  4. package/build/api-client.d.ts +47 -1
  5. package/build/api-client.js +119 -14
  6. package/build/api-client.js.map +1 -1
  7. package/build/worker.js +28 -19
  8. package/build/worker.js.map +1 -1
  9. package/package.json +5 -4
  10. package/src/api/carto-api-error.ts +1 -1
  11. package/src/api/endpoints.ts +1 -1
  12. package/src/api/index.ts +2 -2
  13. package/src/api/query.ts +1 -1
  14. package/src/api/request-with-parameters.ts +2 -2
  15. package/src/deck/get-data-filter-extension-props.ts +3 -3
  16. package/src/fetch-map/basemap-styles.ts +2 -2
  17. package/src/fetch-map/basemap.ts +2 -2
  18. package/src/fetch-map/fetch-map.ts +3 -3
  19. package/src/fetch-map/layer-map.ts +82 -5
  20. package/src/fetch-map/parse-map.ts +71 -7
  21. package/src/fetch-map/source.ts +10 -10
  22. package/src/fetch-map/types.ts +7 -3
  23. package/src/filters/Filter.ts +4 -4
  24. package/src/filters/FilterTypes.ts +1 -1
  25. package/src/filters/geosjonFeatures.ts +3 -3
  26. package/src/filters/tileFeatures.ts +8 -3
  27. package/src/filters/tileFeaturesGeometries.ts +5 -5
  28. package/src/filters/tileFeaturesRaster.ts +3 -3
  29. package/src/filters/tileFeaturesSpatialIndex.ts +4 -4
  30. package/src/filters.ts +1 -1
  31. package/src/geo.ts +1 -1
  32. package/src/index.ts +3 -3
  33. package/src/models/model.ts +6 -3
  34. package/src/operations/aggregation.ts +14 -4
  35. package/src/operations/applySorting.ts +2 -2
  36. package/src/operations/groupBy.ts +2 -2
  37. package/src/operations/groupByDate.ts +2 -2
  38. package/src/operations/histogram.ts +2 -2
  39. package/src/operations/scatterPlot.ts +2 -2
  40. package/src/sources/base-source.ts +7 -4
  41. package/src/sources/boundary-query-source.ts +1 -1
  42. package/src/sources/h3-query-source.ts +1 -1
  43. package/src/sources/h3-table-source.ts +1 -1
  44. package/src/sources/h3-tileset-source.ts +1 -1
  45. package/src/sources/quadbin-query-source.ts +1 -1
  46. package/src/sources/quadbin-table-source.ts +1 -1
  47. package/src/sources/quadbin-tileset-source.ts +1 -1
  48. package/src/sources/raster-source.ts +1 -1
  49. package/src/sources/types.ts +7 -3
  50. package/src/sources/vector-query-source.ts +1 -1
  51. package/src/sources/vector-table-source.ts +1 -1
  52. package/src/sources/vector-tileset-source.ts +1 -1
  53. package/src/utils/getTileFormat.ts +1 -1
  54. package/src/utils/makeIntervalComplete.ts +1 -1
  55. package/src/utils/transformTileCoordsToWGS84.ts +1 -1
  56. package/src/utils/transformToTileCoords.ts +1 -1
  57. package/src/utils.ts +35 -0
  58. package/src/widget-sources/types.ts +5 -2
  59. package/src/widget-sources/widget-query-source.ts +4 -4
  60. package/src/widget-sources/widget-raster-source.ts +2 -2
  61. package/src/widget-sources/widget-remote-source.ts +4 -4
  62. package/src/widget-sources/widget-source.ts +3 -3
  63. package/src/widget-sources/widget-table-source.ts +4 -4
  64. package/src/widget-sources/widget-tileset-source-impl.ts +6 -5
  65. package/src/widget-sources/widget-tileset-source.ts +7 -7
@@ -219,6 +219,32 @@ type PositionalQueryParameter = QueryParameterValue[];
219
219
  /** @privateRemarks Source: @deck.gl/carto */
220
220
  type QueryParameters = NamedQueryParameter | PositionalQueryParameter;
221
221
 
222
+ /******************************************************************************
223
+ * MAP INSTANTIATION
224
+ */
225
+ /**
226
+ * @privateRemarks Source: @deck.gl/carto
227
+ * @internal
228
+ */
229
+ declare enum SchemaFieldType {
230
+ Number = "number",
231
+ Bigint = "bigint",
232
+ String = "string",
233
+ Geometry = "geometry",
234
+ Timestamp = "timestamp",
235
+ Object = "object",
236
+ Boolean = "boolean",
237
+ Variant = "variant",
238
+ Unknown = "unknown"
239
+ }
240
+ /**
241
+ * @privateRemarks Source: @deck.gl/carto
242
+ * @internal
243
+ */
244
+ interface SchemaField {
245
+ name: string;
246
+ type: SchemaFieldType;
247
+ }
222
248
  /******************************************************************************
223
249
  * LOCAL CALCULATIONS
224
250
  */
@@ -630,6 +656,7 @@ type RasterMetadata = {
630
656
  };
631
657
  type TilejsonResult = Tilejson & {
632
658
  accessToken: string;
659
+ schema: SchemaField[];
633
660
  };
634
661
  type QueryResult = {
635
662
  meta: {
@@ -662,6 +689,11 @@ declare const SCALE_FUNCS: Record<string, () => any>;
662
689
  type SCALE_TYPE = keyof typeof SCALE_FUNCS;
663
690
  declare const AGGREGATION: Record<string, string>;
664
691
  declare const OPACITY_MAP: Record<string, string>;
692
+ /** @privateRemarks Source: Builder */
693
+ declare const TEXT_LABEL_INDEX = 0;
694
+ /** @privateRemarks Source: Builder */
695
+ declare const TEXT_OUTLINE_OPACITY = 64;
696
+ declare const TEXT_NUMBER_FORMATTER: Intl.NumberFormat;
665
697
  declare function getLayerProps(type: LayerType, config: MapLayerConfig, dataset: Dataset): {
666
698
  propMap: any;
667
699
  defaultProps: any;
@@ -684,6 +716,18 @@ declare function negateAccessor(accessor: Accessor): Accessor;
684
716
  declare function getSizeAccessor({ name }: VisualChannelField, scaleType: SCALE_TYPE | undefined, aggregation: string | null | undefined, range: Iterable<Range> | null | undefined, data: any): any;
685
717
  declare function getTextAccessor({ name, type }: VisualChannelField, data: any): any;
686
718
 
719
+ /** @privateRemarks Source: Builder */
720
+ declare function calculateClusterRadius(properties: {
721
+ [column: string]: number;
722
+ }, stats: Record<string, {
723
+ min: number;
724
+ max: number;
725
+ }>, radiusRange: [number, number], column: string): number;
726
+ /** @privateRemarks Source: Builder */
727
+ declare function getDefaultAggregationExpColumnAliasForLayerType(layerType: LayerType, provider: ProviderType, schema: SchemaField[]): string;
728
+ /** @privateRemarks Source: Builder */
729
+ declare function calculateClusterTextFontSize(radius: number): number;
730
+
687
731
  type VisualChannelField = {
688
732
  name: string;
689
733
  type: string;
@@ -739,6 +783,8 @@ type VisConfig = {
739
783
  heightRange?: any;
740
784
  heightAggregation?: any;
741
785
  weightAggregation?: any;
786
+ clusterLevel?: number;
787
+ isTextVisible?: boolean;
742
788
  };
743
789
  type TextLabel = {
744
790
  field: VisualChannelField | null | undefined;
@@ -1768,4 +1814,4 @@ declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined
1768
1814
  */
1769
1815
  declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
1770
1816
 
1771
- export { AGGREGATION, type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryRequestOptions, type CategoryResponse, type ColumnsOption, DEFAULT_API_BASE_URL, FEATURE_GEOM_PROPERTY, type FeaturesRequestOptions, type FeaturesResponse, type FetchMapOptions, type FetchMapResult, type Filter, type FilterFunction, type FilterInterval, type FilterIntervalComplete, type FilterIntervalExtremum, type FilterLogicalOperator, type FilterOptions, FilterType, type Filters, type Format, type FormulaRequestOptions, type FormulaResponse, type GetFilterOptions, type GoogleBasemap, type GroupByFeature, type GroupDateType, type H3QuerySourceOptions, type H3QuerySourceResponse, type H3TableSourceOptions, type H3TableSourceResponse, type H3TilesetSourceOptions, type H3TilesetSourceResponse, type HasFilterOptions, type HistogramRequestOptions, type HistogramResponse, type KeplerMapConfig, type Layer, type LayerDescriptor, type LayerType, type MapLibreBasemap, type MapType, type NamedQueryParameter, OPACITY_MAP, type ParseMapResult, type PositionalQueryParameter, Provider, type ProviderType, type QuadbinQuerySourceOptions, type QuadbinQuerySourceResponse, type QuadbinTableSourceOptions, type QuadbinTableSourceResponse, type QuadbinTilesetSourceOptions, type QuadbinTilesetSourceResponse, type QueryOptions, type QueryParameterValue, type QueryParameters, type QueryResult, type QuerySourceOptions, type RangeRequestOptions, type RangeResponse, type Raster, RasterBandColorinterp, type RasterBandType, type RasterMetadata, type RasterMetadataBand, type RasterMetadataBandStats, type RasterSourceOptions, type RasterTile, type RemoveFilterOptions, type SCALE_TYPE, SOURCE_DEFAULTS, type ScatterPlotFeature, type ScatterRequestOptions, type ScatterResponse, type SortColumnType, type SortDirection, type SourceOptionalOptions, type SourceOptions, type SourceRequiredOptions, type SpatialDataType, type SpatialFilter, type SpatialFilterPolyfillMode, SpatialIndex, SpatialIndexColumn, type SpatialIndexTile, type StringSearchOptions, type TableRequestOptions, type TableResponse, type TableSourceOptions, type Tile, type TileFeatureExtractOptions, type TileFeatures, type TileFeaturesSpatialIndexOptions, TileFormat, type TileResolution, type Tilejson, type TilejsonResult, type TilesetSourceOptions, type Tilestats, type TimeSeriesRequestOptions, type TimeSeriesResponse, type VectorLayer, type VectorQuerySourceOptions, type VectorQuerySourceResponse, type VectorTableSourceOptions, type VectorTableSourceResponse, type VectorTilesetSourceOptions, type VectorTilesetSourceResponse, type ViewState, type Viewport, WidgetQuerySource, type WidgetQuerySourceResult, WidgetRasterSource, type WidgetRasterSourceProps, type WidgetRasterSourceResult, WidgetRemoteSource, type WidgetRemoteSourceProps, WidgetSource, type WidgetSourceProps, WidgetTableSource, type WidgetTableSourceResult, WidgetTilesetSource, type WidgetTilesetSourceProps, type WidgetTilesetSourceResult, type _DataFilterExtensionProps, _buildFeatureFilter, domainFromValues as _domainFromValues, _getHexagonResolution, addFilter, aggregate, aggregationFunctions, applyFilters, applySorting, boundaryQuerySource, boundaryTableSource, buildBinaryFeatureFilter, buildPublicMapUrl, buildStatsUrl, clearFilters, configureSource, createPolygonSpatialFilter, createViewportSpatialFilter, fetchBasemapProps, fetchMap, filterFunctions, geojsonFeatures, getApplicableFilters, getClient, getColorAccessor, getColorValueAccessor, getColumnNameFromGeoColumn, getDataFilterExtensionProps, getFilter, getIconUrlAccessor, getLayerProps, getMaxMarkerSize, getSizeAccessor, getSpatialIndexFromGeoColumn, getTextAccessor, groupValuesByColumn, groupValuesByDateColumn, h3QuerySource, h3TableSource, h3TilesetSource, hasFilter, histogram, makeIntervalComplete, negateAccessor, opacityToAlpha, parseMap, quadbinQuerySource, quadbinTableSource, quadbinTilesetSource, query, rasterSource, removeFilter, requestWithParameters, scaleAggregationResLevel, scatterPlot, setClient, tileFeatures, tileFeaturesGeometries, tileFeaturesSpatialIndex, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
1817
+ export { AGGREGATION, type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryRequestOptions, type CategoryResponse, type ColumnsOption, DEFAULT_API_BASE_URL, FEATURE_GEOM_PROPERTY, type FeaturesRequestOptions, type FeaturesResponse, type FetchMapOptions, type FetchMapResult, type Filter, type FilterFunction, type FilterInterval, type FilterIntervalComplete, type FilterIntervalExtremum, type FilterLogicalOperator, type FilterOptions, FilterType, type Filters, type Format, type FormulaRequestOptions, type FormulaResponse, type GetFilterOptions, type GoogleBasemap, type GroupByFeature, type GroupDateType, type H3QuerySourceOptions, type H3QuerySourceResponse, type H3TableSourceOptions, type H3TableSourceResponse, type H3TilesetSourceOptions, type H3TilesetSourceResponse, type HasFilterOptions, type HistogramRequestOptions, type HistogramResponse, type KeplerMapConfig, type Layer, type LayerDescriptor, type LayerType, type MapLibreBasemap, type MapType, type NamedQueryParameter, OPACITY_MAP, type ParseMapResult, type PositionalQueryParameter, Provider, type ProviderType, type QuadbinQuerySourceOptions, type QuadbinQuerySourceResponse, type QuadbinTableSourceOptions, type QuadbinTableSourceResponse, type QuadbinTilesetSourceOptions, type QuadbinTilesetSourceResponse, type QueryOptions, type QueryParameterValue, type QueryParameters, type QueryResult, type QuerySourceOptions, type RangeRequestOptions, type RangeResponse, type Raster, RasterBandColorinterp, type RasterBandType, type RasterMetadata, type RasterMetadataBand, type RasterMetadataBandStats, type RasterSourceOptions, type RasterTile, type RemoveFilterOptions, type SCALE_TYPE, SOURCE_DEFAULTS, type ScatterPlotFeature, type ScatterRequestOptions, type ScatterResponse, type SortColumnType, type SortDirection, type SourceOptionalOptions, type SourceOptions, type SourceRequiredOptions, type SpatialDataType, type SpatialFilter, type SpatialFilterPolyfillMode, SpatialIndex, SpatialIndexColumn, type SpatialIndexTile, type StringSearchOptions, TEXT_LABEL_INDEX, TEXT_NUMBER_FORMATTER, TEXT_OUTLINE_OPACITY, type TableRequestOptions, type TableResponse, type TableSourceOptions, type Tile, type TileFeatureExtractOptions, type TileFeatures, type TileFeaturesSpatialIndexOptions, TileFormat, type TileResolution, type Tilejson, type TilejsonResult, type TilesetSourceOptions, type Tilestats, type TimeSeriesRequestOptions, type TimeSeriesResponse, type VectorLayer, type VectorQuerySourceOptions, type VectorQuerySourceResponse, type VectorTableSourceOptions, type VectorTableSourceResponse, type VectorTilesetSourceOptions, type VectorTilesetSourceResponse, type ViewState, type Viewport, WidgetQuerySource, type WidgetQuerySourceResult, WidgetRasterSource, type WidgetRasterSourceProps, type WidgetRasterSourceResult, WidgetRemoteSource, type WidgetRemoteSourceProps, WidgetSource, type WidgetSourceProps, WidgetTableSource, type WidgetTableSourceResult, WidgetTilesetSource, type WidgetTilesetSourceProps, type WidgetTilesetSourceResult, type _DataFilterExtensionProps, _buildFeatureFilter, domainFromValues as _domainFromValues, _getHexagonResolution, addFilter, aggregate, aggregationFunctions, applyFilters, applySorting, boundaryQuerySource, boundaryTableSource, buildBinaryFeatureFilter, buildPublicMapUrl, buildStatsUrl, calculateClusterRadius, calculateClusterTextFontSize, clearFilters, configureSource, createPolygonSpatialFilter, createViewportSpatialFilter, fetchBasemapProps, fetchMap, filterFunctions, geojsonFeatures, getApplicableFilters, getClient, getColorAccessor, getColorValueAccessor, getColumnNameFromGeoColumn, getDataFilterExtensionProps, getDefaultAggregationExpColumnAliasForLayerType, getFilter, getIconUrlAccessor, getLayerProps, getMaxMarkerSize, getSizeAccessor, getSpatialIndexFromGeoColumn, getTextAccessor, groupValuesByColumn, groupValuesByDateColumn, h3QuerySource, h3TableSource, h3TilesetSource, hasFilter, histogram, makeIntervalComplete, negateAccessor, opacityToAlpha, parseMap, quadbinQuerySource, quadbinTableSource, quadbinTilesetSource, query, rasterSource, removeFilter, requestWithParameters, scaleAggregationResLevel, scatterPlot, setClient, tileFeatures, tileFeaturesGeometries, tileFeaturesSpatialIndex, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
@@ -219,6 +219,32 @@ type PositionalQueryParameter = QueryParameterValue[];
219
219
  /** @privateRemarks Source: @deck.gl/carto */
220
220
  type QueryParameters = NamedQueryParameter | PositionalQueryParameter;
221
221
 
222
+ /******************************************************************************
223
+ * MAP INSTANTIATION
224
+ */
225
+ /**
226
+ * @privateRemarks Source: @deck.gl/carto
227
+ * @internal
228
+ */
229
+ declare enum SchemaFieldType {
230
+ Number = "number",
231
+ Bigint = "bigint",
232
+ String = "string",
233
+ Geometry = "geometry",
234
+ Timestamp = "timestamp",
235
+ Object = "object",
236
+ Boolean = "boolean",
237
+ Variant = "variant",
238
+ Unknown = "unknown"
239
+ }
240
+ /**
241
+ * @privateRemarks Source: @deck.gl/carto
242
+ * @internal
243
+ */
244
+ interface SchemaField {
245
+ name: string;
246
+ type: SchemaFieldType;
247
+ }
222
248
  /******************************************************************************
223
249
  * LOCAL CALCULATIONS
224
250
  */
@@ -630,6 +656,7 @@ type RasterMetadata = {
630
656
  };
631
657
  type TilejsonResult = Tilejson & {
632
658
  accessToken: string;
659
+ schema: SchemaField[];
633
660
  };
634
661
  type QueryResult = {
635
662
  meta: {
@@ -662,6 +689,11 @@ declare const SCALE_FUNCS: Record<string, () => any>;
662
689
  type SCALE_TYPE = keyof typeof SCALE_FUNCS;
663
690
  declare const AGGREGATION: Record<string, string>;
664
691
  declare const OPACITY_MAP: Record<string, string>;
692
+ /** @privateRemarks Source: Builder */
693
+ declare const TEXT_LABEL_INDEX = 0;
694
+ /** @privateRemarks Source: Builder */
695
+ declare const TEXT_OUTLINE_OPACITY = 64;
696
+ declare const TEXT_NUMBER_FORMATTER: Intl.NumberFormat;
665
697
  declare function getLayerProps(type: LayerType, config: MapLayerConfig, dataset: Dataset): {
666
698
  propMap: any;
667
699
  defaultProps: any;
@@ -684,6 +716,18 @@ declare function negateAccessor(accessor: Accessor): Accessor;
684
716
  declare function getSizeAccessor({ name }: VisualChannelField, scaleType: SCALE_TYPE | undefined, aggregation: string | null | undefined, range: Iterable<Range> | null | undefined, data: any): any;
685
717
  declare function getTextAccessor({ name, type }: VisualChannelField, data: any): any;
686
718
 
719
+ /** @privateRemarks Source: Builder */
720
+ declare function calculateClusterRadius(properties: {
721
+ [column: string]: number;
722
+ }, stats: Record<string, {
723
+ min: number;
724
+ max: number;
725
+ }>, radiusRange: [number, number], column: string): number;
726
+ /** @privateRemarks Source: Builder */
727
+ declare function getDefaultAggregationExpColumnAliasForLayerType(layerType: LayerType, provider: ProviderType, schema: SchemaField[]): string;
728
+ /** @privateRemarks Source: Builder */
729
+ declare function calculateClusterTextFontSize(radius: number): number;
730
+
687
731
  type VisualChannelField = {
688
732
  name: string;
689
733
  type: string;
@@ -739,6 +783,8 @@ type VisConfig = {
739
783
  heightRange?: any;
740
784
  heightAggregation?: any;
741
785
  weightAggregation?: any;
786
+ clusterLevel?: number;
787
+ isTextVisible?: boolean;
742
788
  };
743
789
  type TextLabel = {
744
790
  field: VisualChannelField | null | undefined;
@@ -1768,4 +1814,4 @@ declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined
1768
1814
  */
1769
1815
  declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
1770
1816
 
1771
- export { AGGREGATION, type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryRequestOptions, type CategoryResponse, type ColumnsOption, DEFAULT_API_BASE_URL, FEATURE_GEOM_PROPERTY, type FeaturesRequestOptions, type FeaturesResponse, type FetchMapOptions, type FetchMapResult, type Filter, type FilterFunction, type FilterInterval, type FilterIntervalComplete, type FilterIntervalExtremum, type FilterLogicalOperator, type FilterOptions, FilterType, type Filters, type Format, type FormulaRequestOptions, type FormulaResponse, type GetFilterOptions, type GoogleBasemap, type GroupByFeature, type GroupDateType, type H3QuerySourceOptions, type H3QuerySourceResponse, type H3TableSourceOptions, type H3TableSourceResponse, type H3TilesetSourceOptions, type H3TilesetSourceResponse, type HasFilterOptions, type HistogramRequestOptions, type HistogramResponse, type KeplerMapConfig, type Layer, type LayerDescriptor, type LayerType, type MapLibreBasemap, type MapType, type NamedQueryParameter, OPACITY_MAP, type ParseMapResult, type PositionalQueryParameter, Provider, type ProviderType, type QuadbinQuerySourceOptions, type QuadbinQuerySourceResponse, type QuadbinTableSourceOptions, type QuadbinTableSourceResponse, type QuadbinTilesetSourceOptions, type QuadbinTilesetSourceResponse, type QueryOptions, type QueryParameterValue, type QueryParameters, type QueryResult, type QuerySourceOptions, type RangeRequestOptions, type RangeResponse, type Raster, RasterBandColorinterp, type RasterBandType, type RasterMetadata, type RasterMetadataBand, type RasterMetadataBandStats, type RasterSourceOptions, type RasterTile, type RemoveFilterOptions, type SCALE_TYPE, SOURCE_DEFAULTS, type ScatterPlotFeature, type ScatterRequestOptions, type ScatterResponse, type SortColumnType, type SortDirection, type SourceOptionalOptions, type SourceOptions, type SourceRequiredOptions, type SpatialDataType, type SpatialFilter, type SpatialFilterPolyfillMode, SpatialIndex, SpatialIndexColumn, type SpatialIndexTile, type StringSearchOptions, type TableRequestOptions, type TableResponse, type TableSourceOptions, type Tile, type TileFeatureExtractOptions, type TileFeatures, type TileFeaturesSpatialIndexOptions, TileFormat, type TileResolution, type Tilejson, type TilejsonResult, type TilesetSourceOptions, type Tilestats, type TimeSeriesRequestOptions, type TimeSeriesResponse, type VectorLayer, type VectorQuerySourceOptions, type VectorQuerySourceResponse, type VectorTableSourceOptions, type VectorTableSourceResponse, type VectorTilesetSourceOptions, type VectorTilesetSourceResponse, type ViewState, type Viewport, WidgetQuerySource, type WidgetQuerySourceResult, WidgetRasterSource, type WidgetRasterSourceProps, type WidgetRasterSourceResult, WidgetRemoteSource, type WidgetRemoteSourceProps, WidgetSource, type WidgetSourceProps, WidgetTableSource, type WidgetTableSourceResult, WidgetTilesetSource, type WidgetTilesetSourceProps, type WidgetTilesetSourceResult, type _DataFilterExtensionProps, _buildFeatureFilter, domainFromValues as _domainFromValues, _getHexagonResolution, addFilter, aggregate, aggregationFunctions, applyFilters, applySorting, boundaryQuerySource, boundaryTableSource, buildBinaryFeatureFilter, buildPublicMapUrl, buildStatsUrl, clearFilters, configureSource, createPolygonSpatialFilter, createViewportSpatialFilter, fetchBasemapProps, fetchMap, filterFunctions, geojsonFeatures, getApplicableFilters, getClient, getColorAccessor, getColorValueAccessor, getColumnNameFromGeoColumn, getDataFilterExtensionProps, getFilter, getIconUrlAccessor, getLayerProps, getMaxMarkerSize, getSizeAccessor, getSpatialIndexFromGeoColumn, getTextAccessor, groupValuesByColumn, groupValuesByDateColumn, h3QuerySource, h3TableSource, h3TilesetSource, hasFilter, histogram, makeIntervalComplete, negateAccessor, opacityToAlpha, parseMap, quadbinQuerySource, quadbinTableSource, quadbinTilesetSource, query, rasterSource, removeFilter, requestWithParameters, scaleAggregationResLevel, scatterPlot, setClient, tileFeatures, tileFeaturesGeometries, tileFeaturesSpatialIndex, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
1817
+ export { AGGREGATION, type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryRequestOptions, type CategoryResponse, type ColumnsOption, DEFAULT_API_BASE_URL, FEATURE_GEOM_PROPERTY, type FeaturesRequestOptions, type FeaturesResponse, type FetchMapOptions, type FetchMapResult, type Filter, type FilterFunction, type FilterInterval, type FilterIntervalComplete, type FilterIntervalExtremum, type FilterLogicalOperator, type FilterOptions, FilterType, type Filters, type Format, type FormulaRequestOptions, type FormulaResponse, type GetFilterOptions, type GoogleBasemap, type GroupByFeature, type GroupDateType, type H3QuerySourceOptions, type H3QuerySourceResponse, type H3TableSourceOptions, type H3TableSourceResponse, type H3TilesetSourceOptions, type H3TilesetSourceResponse, type HasFilterOptions, type HistogramRequestOptions, type HistogramResponse, type KeplerMapConfig, type Layer, type LayerDescriptor, type LayerType, type MapLibreBasemap, type MapType, type NamedQueryParameter, OPACITY_MAP, type ParseMapResult, type PositionalQueryParameter, Provider, type ProviderType, type QuadbinQuerySourceOptions, type QuadbinQuerySourceResponse, type QuadbinTableSourceOptions, type QuadbinTableSourceResponse, type QuadbinTilesetSourceOptions, type QuadbinTilesetSourceResponse, type QueryOptions, type QueryParameterValue, type QueryParameters, type QueryResult, type QuerySourceOptions, type RangeRequestOptions, type RangeResponse, type Raster, RasterBandColorinterp, type RasterBandType, type RasterMetadata, type RasterMetadataBand, type RasterMetadataBandStats, type RasterSourceOptions, type RasterTile, type RemoveFilterOptions, type SCALE_TYPE, SOURCE_DEFAULTS, type ScatterPlotFeature, type ScatterRequestOptions, type ScatterResponse, type SortColumnType, type SortDirection, type SourceOptionalOptions, type SourceOptions, type SourceRequiredOptions, type SpatialDataType, type SpatialFilter, type SpatialFilterPolyfillMode, SpatialIndex, SpatialIndexColumn, type SpatialIndexTile, type StringSearchOptions, TEXT_LABEL_INDEX, TEXT_NUMBER_FORMATTER, TEXT_OUTLINE_OPACITY, type TableRequestOptions, type TableResponse, type TableSourceOptions, type Tile, type TileFeatureExtractOptions, type TileFeatures, type TileFeaturesSpatialIndexOptions, TileFormat, type TileResolution, type Tilejson, type TilejsonResult, type TilesetSourceOptions, type Tilestats, type TimeSeriesRequestOptions, type TimeSeriesResponse, type VectorLayer, type VectorQuerySourceOptions, type VectorQuerySourceResponse, type VectorTableSourceOptions, type VectorTableSourceResponse, type VectorTilesetSourceOptions, type VectorTilesetSourceResponse, type ViewState, type Viewport, WidgetQuerySource, type WidgetQuerySourceResult, WidgetRasterSource, type WidgetRasterSourceProps, type WidgetRasterSourceResult, WidgetRemoteSource, type WidgetRemoteSourceProps, WidgetSource, type WidgetSourceProps, WidgetTableSource, type WidgetTableSourceResult, WidgetTilesetSource, type WidgetTilesetSourceProps, type WidgetTilesetSourceResult, type _DataFilterExtensionProps, _buildFeatureFilter, domainFromValues as _domainFromValues, _getHexagonResolution, addFilter, aggregate, aggregationFunctions, applyFilters, applySorting, boundaryQuerySource, boundaryTableSource, buildBinaryFeatureFilter, buildPublicMapUrl, buildStatsUrl, calculateClusterRadius, calculateClusterTextFontSize, clearFilters, configureSource, createPolygonSpatialFilter, createViewportSpatialFilter, fetchBasemapProps, fetchMap, filterFunctions, geojsonFeatures, getApplicableFilters, getClient, getColorAccessor, getColorValueAccessor, getColumnNameFromGeoColumn, getDataFilterExtensionProps, getDefaultAggregationExpColumnAliasForLayerType, getFilter, getIconUrlAccessor, getLayerProps, getMaxMarkerSize, getSizeAccessor, getSpatialIndexFromGeoColumn, getTextAccessor, groupValuesByColumn, groupValuesByDateColumn, h3QuerySource, h3TableSource, h3TilesetSource, hasFilter, histogram, makeIntervalComplete, negateAccessor, opacityToAlpha, parseMap, quadbinQuerySource, quadbinTableSource, quadbinTilesetSource, query, rasterSource, removeFilter, requestWithParameters, scaleAggregationResLevel, scatterPlot, setClient, tileFeatures, tileFeaturesGeometries, tileFeaturesSpatialIndex, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
@@ -10894,6 +10894,7 @@ function isValidBandValue(value, nodata) {
10894
10894
  }
10895
10895
 
10896
10896
  // src/utils.ts
10897
+ var FILTER_TYPES = new Set(Object.values(FilterType));
10897
10898
  function normalizeObjectKeys(el) {
10898
10899
  if (Array.isArray(el)) {
10899
10900
  return el.map((value) => normalizeObjectKeys(value));
@@ -11294,7 +11295,7 @@ async function baseSource(endpoint, options, urlParameters) {
11294
11295
  type: endpoint,
11295
11296
  source: JSON.stringify(parameters, void 0, 2)
11296
11297
  };
11297
- const mapInstantiation = await requestWithParameters({
11298
+ const { tilejson, schema } = await requestWithParameters({
11298
11299
  baseUrl,
11299
11300
  parameters,
11300
11301
  headers,
@@ -11302,7 +11303,7 @@ async function baseSource(endpoint, options, urlParameters) {
11302
11303
  maxLengthURL,
11303
11304
  localCache
11304
11305
  });
11305
- const dataUrl = mapInstantiation.tilejson.url[0];
11306
+ const dataUrl = tilejson.url[0];
11306
11307
  if (cache) {
11307
11308
  cache.value = parseInt(
11308
11309
  new URL(dataUrl).searchParams.get("cache") || "",
@@ -11321,6 +11322,9 @@ async function baseSource(endpoint, options, urlParameters) {
11321
11322
  if (accessToken) {
11322
11323
  json.accessToken = accessToken;
11323
11324
  }
11325
+ if (schema) {
11326
+ json.schema = schema;
11327
+ }
11324
11328
  return json;
11325
11329
  }
11326
11330
 
@@ -11541,8 +11545,8 @@ function objectToURLSearchParams(object) {
11541
11545
  }
11542
11546
 
11543
11547
  // src/filters.ts
11544
- var FILTER_TYPES = new Set(Object.values(FilterType));
11545
- var isFilterType = (type) => FILTER_TYPES.has(type);
11548
+ var FILTER_TYPES2 = new Set(Object.values(FilterType));
11549
+ var isFilterType = (type) => FILTER_TYPES2.has(type);
11546
11550
  function addFilter(filters, { column, type, values, owner }) {
11547
11551
  if (!filters[column]) {
11548
11552
  filters[column] = {};
@@ -11557,7 +11561,7 @@ function removeFilter(filters, { column, owner }) {
11557
11561
  return filters;
11558
11562
  }
11559
11563
  if (owner) {
11560
- for (const type of FILTER_TYPES) {
11564
+ for (const type of FILTER_TYPES2) {
11561
11565
  if (owner === filter[type]?.owner) {
11562
11566
  delete filter[type];
11563
11567
  }
@@ -11582,7 +11586,7 @@ function hasFilter(filters, { column, owner }) {
11582
11586
  if (!owner) {
11583
11587
  return true;
11584
11588
  }
11585
- for (const type of FILTER_TYPES) {
11589
+ for (const type of FILTER_TYPES2) {
11586
11590
  if (owner === filter[type]?.owner) {
11587
11591
  return true;
11588
11592
  }
@@ -11941,7 +11945,11 @@ function min(values, keys, joinOperation) {
11941
11945
  Infinity
11942
11946
  );
11943
11947
  }
11944
- return Math.min(...values);
11948
+ let min3 = Number.POSITIVE_INFINITY;
11949
+ for (const value of values) {
11950
+ min3 = Math.min(min3, value);
11951
+ }
11952
+ return min3;
11945
11953
  }
11946
11954
  function max(values, keys, joinOperation) {
11947
11955
  const normalizedKeys = normalizeKeys(keys);
@@ -11951,7 +11959,11 @@ function max(values, keys, joinOperation) {
11951
11959
  -Infinity
11952
11960
  );
11953
11961
  }
11954
- return Math.max(...values);
11962
+ let max3 = Number.NEGATIVE_INFINITY;
11963
+ for (const value of values) {
11964
+ max3 = Math.max(max3, value);
11965
+ }
11966
+ return max3;
11955
11967
  }
11956
11968
  function normalizeKeys(keys) {
11957
11969
  return Array.isArray(keys) ? keys : typeof keys === "string" ? [keys] : void 0;
@@ -14240,7 +14252,8 @@ var customMarkersPropsMap = {
14240
14252
  var heatmapTilePropsMap = {
14241
14253
  visConfig: {
14242
14254
  colorRange: (x) => ({ colorRange: x.colors.map(hexToRGBA) }),
14243
- radius: "radiusPixels"
14255
+ radius: (radius) => ({ radiusPixels: 20 + radius }),
14256
+ opacity: "opacity"
14244
14257
  }
14245
14258
  };
14246
14259
  var defaultProps = {
@@ -14261,6 +14274,12 @@ var deprecatedLayerTypes = [
14261
14274
  "hexagonId",
14262
14275
  "point"
14263
14276
  ];
14277
+ var TEXT_LABEL_INDEX = 0;
14278
+ var TEXT_OUTLINE_OPACITY = 64;
14279
+ var TEXT_NUMBER_FORMATTER = new Intl.NumberFormat("en-US", {
14280
+ maximumFractionDigits: 2,
14281
+ notation: "compact"
14282
+ });
14264
14283
  function getLayerProps(type, config2, dataset) {
14265
14284
  if (deprecatedLayerTypes.includes(type)) {
14266
14285
  throw new Error(
@@ -14352,9 +14371,7 @@ function findAccessorKey(keys, properties) {
14352
14371
  return [key];
14353
14372
  }
14354
14373
  }
14355
- throw new Error(
14356
- `Could not find property for any accessor key: ${keys.join(", ")}`
14357
- );
14374
+ return keys;
14358
14375
  }
14359
14376
  function getColorValueAccessor({ name }, colorAggregation, data) {
14360
14377
  const aggregator = AGGREGATION_FUNC[colorAggregation];
@@ -14481,6 +14498,40 @@ function getTextAccessor({ name, type }, data) {
14481
14498
  };
14482
14499
  return normalizeAccessor(accessor, data);
14483
14500
  }
14501
+ function calculateClusterRadius(properties, stats, radiusRange, column) {
14502
+ const { min: min3, max: max3 } = stats[column];
14503
+ const value = properties[column];
14504
+ if (min3 === max3) return radiusRange[1];
14505
+ const normalizedValue = (value - min3) / (max3 - min3);
14506
+ return radiusRange[0] + normalizedValue * (radiusRange[1] - radiusRange[0]);
14507
+ }
14508
+ function getDefaultAggregationExpColumnAliasForLayerType(layerType, provider, schema) {
14509
+ if (schema && layerType === "clusterTile") {
14510
+ return getColumnAliasForAggregationExp(
14511
+ getDefaultColumnFromSchemaForAggregationExp(schema),
14512
+ "count",
14513
+ provider
14514
+ );
14515
+ } else {
14516
+ return DEFAULT_AGGREGATION_EXP_ALIAS;
14517
+ }
14518
+ }
14519
+ function getColumnAliasForAggregationExp(name, aggregation, provider) {
14520
+ const columnAlias = `${name}_${aggregation}`;
14521
+ return provider === "snowflake" ? columnAlias.toUpperCase() : columnAlias;
14522
+ }
14523
+ function getDefaultColumnFromSchemaForAggregationExp(schema) {
14524
+ return schema ? schema[0].name : "";
14525
+ }
14526
+ function calculateClusterTextFontSize(radius) {
14527
+ if (radius >= 80) return 24;
14528
+ if (radius >= 72) return 24;
14529
+ if (radius >= 56) return 20;
14530
+ if (radius >= 40) return 16;
14531
+ if (radius >= 24) return 13;
14532
+ if (radius >= 8) return 11;
14533
+ return 11;
14534
+ }
14484
14535
 
14485
14536
  // src/fetch-map/parse-map.ts
14486
14537
  function parseMap(json) {
@@ -14521,7 +14572,14 @@ function parseMap(json) {
14521
14572
  ...defaultProps2,
14522
14573
  ...createInteractionProps(interactionConfig),
14523
14574
  ...styleProps,
14524
- ...createChannelProps(id, type, config3, visualChannels, data),
14575
+ ...createChannelProps(
14576
+ id,
14577
+ type,
14578
+ config3,
14579
+ visualChannels,
14580
+ data,
14581
+ dataset
14582
+ ),
14525
14583
  // Must come after style
14526
14584
  ...createParametersProp(
14527
14585
  layerBlending,
@@ -14596,7 +14654,7 @@ function createStyleProps(config2, mapping) {
14596
14654
  result.highlightColor = config2.visConfig.enable3d ? [255, 255, 255, 60] : [252, 242, 26, 255];
14597
14655
  return result;
14598
14656
  }
14599
- function createChannelProps(id, type, config2, visualChannels, data) {
14657
+ function createChannelProps(id, type, config2, visualChannels, data, dataset) {
14600
14658
  const {
14601
14659
  colorField,
14602
14660
  colorScale,
@@ -14656,6 +14714,47 @@ function createChannelProps(id, type, config2, visualChannels, data) {
14656
14714
  };
14657
14715
  }
14658
14716
  }
14717
+ if (type === "clusterTile") {
14718
+ const aggregationExpAlias = getDefaultAggregationExpColumnAliasForLayerType(
14719
+ type,
14720
+ dataset.providerId,
14721
+ data.schema
14722
+ );
14723
+ result.pointType = visConfig.isTextVisible ? "circle+text" : "circle";
14724
+ result.clusterLevel = visConfig.clusterLevel;
14725
+ result.getWeight = (d) => {
14726
+ return d.properties[aggregationExpAlias];
14727
+ };
14728
+ result.getPointRadius = (d, info) => {
14729
+ return calculateClusterRadius(
14730
+ d.properties,
14731
+ info.data.attributes.stats,
14732
+ visConfig.radiusRange,
14733
+ aggregationExpAlias
14734
+ );
14735
+ };
14736
+ result.textCharacterSet = "auto";
14737
+ result.textFontFamily = "Inter, sans";
14738
+ result.textFontSettings = { sdf: true };
14739
+ result.textFontWeight = 600;
14740
+ result.getText = (d) => TEXT_NUMBER_FORMATTER.format(d.properties[aggregationExpAlias]);
14741
+ result.getTextColor = config2.textLabel[TEXT_LABEL_INDEX].color;
14742
+ result.textOutlineColor = [
14743
+ ...config2.textLabel[TEXT_LABEL_INDEX].outlineColor,
14744
+ TEXT_OUTLINE_OPACITY
14745
+ ];
14746
+ result.textOutlineWidth = 5;
14747
+ result.textSizeUnits = "pixels";
14748
+ result.getTextSize = (d, info) => {
14749
+ const radius = calculateClusterRadius(
14750
+ d.properties,
14751
+ info.data.attributes.stats,
14752
+ visConfig.radiusRange,
14753
+ aggregationExpAlias
14754
+ );
14755
+ return calculateClusterTextFontSize(radius);
14756
+ };
14757
+ }
14659
14758
  if (radiusField || sizeField) {
14660
14759
  result.getPointRadius = getSizeAccessor(
14661
14760
  // @ts-ignore
@@ -15366,6 +15465,9 @@ export {
15366
15465
  SOURCE_DEFAULTS,
15367
15466
  SpatialIndex,
15368
15467
  SpatialIndexColumn,
15468
+ TEXT_LABEL_INDEX,
15469
+ TEXT_NUMBER_FORMATTER,
15470
+ TEXT_OUTLINE_OPACITY,
15369
15471
  TileFormat,
15370
15472
  WidgetQuerySource,
15371
15473
  WidgetRasterSource,
@@ -15386,6 +15488,8 @@ export {
15386
15488
  buildBinaryFeatureFilter,
15387
15489
  buildPublicMapUrl,
15388
15490
  buildStatsUrl,
15491
+ calculateClusterRadius,
15492
+ calculateClusterTextFontSize,
15389
15493
  clearFilters,
15390
15494
  configureSource,
15391
15495
  createPolygonSpatialFilter,
@@ -15400,6 +15504,7 @@ export {
15400
15504
  getColorValueAccessor,
15401
15505
  getColumnNameFromGeoColumn,
15402
15506
  getDataFilterExtensionProps,
15507
+ getDefaultAggregationExpColumnAliasForLayerType,
15403
15508
  getFilter,
15404
15509
  getIconUrlAccessor,
15405
15510
  getLayerProps,