@carto/api-client 0.5.5-alpha.0 → 0.5.6-alpha.0

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.
@@ -688,9 +688,12 @@ declare function clearDefaultRequestCache(): void;
688
688
 
689
689
  type LayerType = 'clusterTile' | 'h3' | 'heatmapTile' | 'mvt' | 'quadbin' | 'raster' | 'tileset';
690
690
 
691
- declare const SCALE_FUNCS: Record<string, () => any>;
692
- type SCALE_TYPE = keyof typeof SCALE_FUNCS;
693
- declare const AGGREGATION: Record<string, string>;
691
+ type D3Scale = {
692
+ domain: (d?: any) => any[];
693
+ range: (d?: any) => any[];
694
+ unknown?: (d?: string) => any;
695
+ } & ((d: any) => any);
696
+ type ScaleType = 'linear' | 'ordinal' | 'log' | 'point' | 'quantile' | 'quantize' | 'sqrt' | 'custom' | 'identity';
694
697
  declare const OPACITY_MAP: Record<string, string>;
695
698
  /** @privateRemarks Source: Builder */
696
699
  declare const TEXT_LABEL_INDEX = 0;
@@ -701,13 +704,15 @@ declare function getLayerProps(type: LayerType, config: MapLayerConfig, dataset:
701
704
  propMap: any;
702
705
  defaultProps: any;
703
706
  };
704
- declare function domainFromValues(values: any, scaleType: SCALE_TYPE): any;
707
+ declare function domainFromValues(values: any, scaleType: ScaleType): any;
705
708
  declare function opacityToAlpha(opacity?: number): number;
706
- declare function getColorValueAccessor({ name }: VisualChannelField, colorAggregation: string, data: any): any;
707
- declare function getColorAccessor({ name, colorColumn }: VisualChannelField, scaleType: SCALE_TYPE, { aggregation, range }: {
709
+ declare function getColorAccessor({ name, colorColumn }: VisualChannelField, scaleType: ScaleType, { aggregation, range }: {
708
710
  aggregation: string;
709
711
  range: any;
710
- }, opacity: number | undefined, data: any): any;
712
+ }, opacity: number | undefined, data: any): {
713
+ accessor: any;
714
+ scale: any;
715
+ };
711
716
  declare function getIconUrlAccessor(field: VisualChannelField | null | undefined, range: CustomMarkersRange | null | undefined, { fallbackUrl, maxIconSize, useMaskedIcons, }: {
712
717
  fallbackUrl?: string | null;
713
718
  maxIconSize: number;
@@ -716,7 +721,10 @@ declare function getIconUrlAccessor(field: VisualChannelField | null | undefined
716
721
  declare function getMaxMarkerSize(visConfig: VisConfig, visualChannels: VisualChannels): number;
717
722
  type Accessor = number | ((d: any, i: any) => number);
718
723
  declare function negateAccessor(accessor: Accessor): Accessor;
719
- declare function getSizeAccessor({ name }: VisualChannelField, scaleType: SCALE_TYPE | undefined, aggregation: string | null | undefined, range: Iterable<Range> | null | undefined, data: any): any;
724
+ declare function getSizeAccessor({ name }: VisualChannelField, scaleType: ScaleType | undefined, aggregation: string | null | undefined, range: Iterable<Range> | null | undefined, data: any): {
725
+ accessor: any;
726
+ scale: any;
727
+ };
720
728
  declare function getTextAccessor({ name, type }: VisualChannelField, data: any): any;
721
729
 
722
730
  /** @privateRemarks Source: Builder */
@@ -738,19 +746,19 @@ type VisualChannelField = {
738
746
  };
739
747
  type VisualChannels = {
740
748
  colorField?: VisualChannelField;
741
- colorScale?: SCALE_TYPE;
749
+ colorScale?: ScaleType;
742
750
  customMarkersField?: VisualChannelField;
743
- customMarkersScale?: SCALE_TYPE;
751
+ customMarkersScale?: ScaleType;
744
752
  radiusField?: VisualChannelField;
745
- radiusScale?: SCALE_TYPE;
746
- rotationScale?: SCALE_TYPE;
753
+ radiusScale?: ScaleType;
754
+ rotationScale?: ScaleType;
747
755
  rotationField?: VisualChannelField;
748
756
  sizeField?: VisualChannelField;
749
- sizeScale?: SCALE_TYPE;
757
+ sizeScale?: ScaleType;
750
758
  strokeColorField?: VisualChannelField;
751
- strokeColorScale?: SCALE_TYPE;
759
+ strokeColorScale?: ScaleType;
752
760
  heightField?: VisualChannelField;
753
- heightScale?: SCALE_TYPE;
761
+ heightScale?: ScaleType;
754
762
  weightField?: VisualChannelField;
755
763
  };
756
764
  type ColorRange = {
@@ -931,10 +939,17 @@ declare const _default: {
931
939
  readonly DARK_MATTER_NOLABELS: string;
932
940
  };
933
941
 
942
+ type Scale = {
943
+ field: VisualChannelField;
944
+ domain: string[] | number[];
945
+ range: string[] | number[];
946
+ type: ScaleType;
947
+ };
934
948
  type LayerDescriptor = {
935
949
  type: LayerType;
936
950
  props: Record<string, any>;
937
951
  filters?: Filters;
952
+ scales: Record<ScaleKey, Scale>;
938
953
  };
939
954
  type ParseMapResult = {
940
955
  /** Map id. */
@@ -969,6 +984,7 @@ declare function parseMap(json: any): {
969
984
  token: any;
970
985
  layers: (LayerDescriptor | undefined)[];
971
986
  };
987
+ type ScaleKey = 'fillColor' | 'pointRadius' | 'lineColor' | 'elevation' | 'weight';
972
988
 
973
989
  type FetchMapOptions = {
974
990
  /**
@@ -1131,10 +1147,31 @@ interface BaseRequestOptions {
1131
1147
  filters?: Filters;
1132
1148
  filterOwner?: string;
1133
1149
  }
1134
- /** Options for {@link WidgetRemoteSource#getCategories}. */
1150
+ /**
1151
+ * Examples:
1152
+ * * population by state
1153
+ * * column: 'state'
1154
+ * * operation: 'sum'
1155
+ * * operationColumn: 'population'
1156
+ * * average salary by department
1157
+ * * column: 'department'
1158
+ * * operation: 'avg'
1159
+ * * operationColumn: 'salary'
1160
+ * * custom aggregation by storetype
1161
+ * * column: 'storetype'
1162
+ * * operation: 'custom'
1163
+ * * operationExp: 'sum(sales)/sum(area)'
1164
+ *
1165
+ * Options for {@link WidgetRemoteSource#getCategories}.
1166
+ */
1135
1167
  interface CategoryRequestOptions extends BaseRequestOptions {
1168
+ /** The column that to categorize by. */
1136
1169
  column: string;
1137
- operation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
1170
+ /** The type of aggregation to apply on data in scope of each category. */
1171
+ operation: AggregationType;
1172
+ /** Remote only. Only valid if operation is 'custom' */
1173
+ operationExp?: string;
1174
+ /** The aggregated column per each category. */
1138
1175
  operationColumn?: string;
1139
1176
  /** Local only. */
1140
1177
  joinOperation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
@@ -1176,11 +1213,28 @@ interface FeaturesRequestOptions extends BaseRequestOptions {
1176
1213
  */
1177
1214
  tileResolution?: TileResolution;
1178
1215
  }
1179
- /** Options for {@link WidgetRemoteSource#getFormula}. */
1216
+ /**
1217
+ * Examples:
1218
+ * * sum of all sales
1219
+ * * column: 'sales'
1220
+ * * operation: 'sum'
1221
+ * * average salary
1222
+ * * column: 'salary'
1223
+ * * operation: 'avg'
1224
+ * * custom aggregation over all rows
1225
+ * * operation: 'custom'
1226
+ * * operationExp: 'sum(sales)/sum(area)'
1227
+ *
1228
+ * Options for {@link WidgetRemoteSource#getFormula}.
1229
+ */
1180
1230
  interface FormulaRequestOptions extends BaseRequestOptions {
1181
- column: string;
1182
- operation?: 'count' | 'avg' | 'min' | 'max' | 'sum' | 'custom';
1231
+ /** The column to apply the aggregation operation on. Not needed for 'custom' operation. */
1232
+ column?: string;
1233
+ /** The type of aggregation to apply on data. */
1234
+ operation: AggregationType;
1235
+ /** Remote only. Only valid if operation is 'custom' */
1183
1236
  operationExp?: string;
1237
+ /** Local only. */
1184
1238
  joinOperation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
1185
1239
  }
1186
1240
  /** Options for {@link WidgetRemoteSource#getHistogram}. */
@@ -1215,12 +1269,25 @@ interface TableRequestOptions extends BaseRequestOptions {
1215
1269
  /** @deprecated Supported for tilesets only. Prefer `filters` (for all sources) instead. */
1216
1270
  searchFilterText?: string;
1217
1271
  }
1218
- /** Options for {@link WidgetRemoteSource#getTimeSeries}. */
1272
+ /**
1273
+ * Examples:
1274
+ * * sum of all sales by month
1275
+ * * column: 'sales'
1276
+ * * stepSize: 'month'
1277
+ * * operation: 'sum'
1278
+ * * average salary by year
1279
+ * * column: 'salary'
1280
+ * * stepSize: 'year'
1281
+ * * operation: 'avg'
1282
+ * Options for {@link WidgetRemoteSource#getTimeSeries}.
1283
+ */
1219
1284
  interface TimeSeriesRequestOptions extends BaseRequestOptions {
1220
1285
  column: string;
1221
1286
  stepSize: GroupDateType;
1222
1287
  stepMultiplier?: number;
1223
- operation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
1288
+ operation: AggregationType;
1289
+ /** Remote only. Only valid if operation is 'custom' */
1290
+ operationExp?: string;
1224
1291
  operationColumn?: string;
1225
1292
  joinOperation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
1226
1293
  splitByCategory?: string;
@@ -1818,4 +1885,4 @@ declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined
1818
1885
  */
1819
1886
  declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
1820
1887
 
1821
- 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 SchemaField, SchemaFieldType, 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, clearDefaultRequestCache, 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 };
1888
+ export { 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, type D3Scale, 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, SOURCE_DEFAULTS, type Scale, type ScaleKey, type ScaleType, type ScatterPlotFeature, type ScatterRequestOptions, type ScatterResponse, type SchemaField, SchemaFieldType, 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, clearDefaultRequestCache, clearFilters, configureSource, createPolygonSpatialFilter, createViewportSpatialFilter, fetchBasemapProps, fetchMap, filterFunctions, geojsonFeatures, getApplicableFilters, getClient, getColorAccessor, 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 };
@@ -688,9 +688,12 @@ declare function clearDefaultRequestCache(): void;
688
688
 
689
689
  type LayerType = 'clusterTile' | 'h3' | 'heatmapTile' | 'mvt' | 'quadbin' | 'raster' | 'tileset';
690
690
 
691
- declare const SCALE_FUNCS: Record<string, () => any>;
692
- type SCALE_TYPE = keyof typeof SCALE_FUNCS;
693
- declare const AGGREGATION: Record<string, string>;
691
+ type D3Scale = {
692
+ domain: (d?: any) => any[];
693
+ range: (d?: any) => any[];
694
+ unknown?: (d?: string) => any;
695
+ } & ((d: any) => any);
696
+ type ScaleType = 'linear' | 'ordinal' | 'log' | 'point' | 'quantile' | 'quantize' | 'sqrt' | 'custom' | 'identity';
694
697
  declare const OPACITY_MAP: Record<string, string>;
695
698
  /** @privateRemarks Source: Builder */
696
699
  declare const TEXT_LABEL_INDEX = 0;
@@ -701,13 +704,15 @@ declare function getLayerProps(type: LayerType, config: MapLayerConfig, dataset:
701
704
  propMap: any;
702
705
  defaultProps: any;
703
706
  };
704
- declare function domainFromValues(values: any, scaleType: SCALE_TYPE): any;
707
+ declare function domainFromValues(values: any, scaleType: ScaleType): any;
705
708
  declare function opacityToAlpha(opacity?: number): number;
706
- declare function getColorValueAccessor({ name }: VisualChannelField, colorAggregation: string, data: any): any;
707
- declare function getColorAccessor({ name, colorColumn }: VisualChannelField, scaleType: SCALE_TYPE, { aggregation, range }: {
709
+ declare function getColorAccessor({ name, colorColumn }: VisualChannelField, scaleType: ScaleType, { aggregation, range }: {
708
710
  aggregation: string;
709
711
  range: any;
710
- }, opacity: number | undefined, data: any): any;
712
+ }, opacity: number | undefined, data: any): {
713
+ accessor: any;
714
+ scale: any;
715
+ };
711
716
  declare function getIconUrlAccessor(field: VisualChannelField | null | undefined, range: CustomMarkersRange | null | undefined, { fallbackUrl, maxIconSize, useMaskedIcons, }: {
712
717
  fallbackUrl?: string | null;
713
718
  maxIconSize: number;
@@ -716,7 +721,10 @@ declare function getIconUrlAccessor(field: VisualChannelField | null | undefined
716
721
  declare function getMaxMarkerSize(visConfig: VisConfig, visualChannels: VisualChannels): number;
717
722
  type Accessor = number | ((d: any, i: any) => number);
718
723
  declare function negateAccessor(accessor: Accessor): Accessor;
719
- declare function getSizeAccessor({ name }: VisualChannelField, scaleType: SCALE_TYPE | undefined, aggregation: string | null | undefined, range: Iterable<Range> | null | undefined, data: any): any;
724
+ declare function getSizeAccessor({ name }: VisualChannelField, scaleType: ScaleType | undefined, aggregation: string | null | undefined, range: Iterable<Range> | null | undefined, data: any): {
725
+ accessor: any;
726
+ scale: any;
727
+ };
720
728
  declare function getTextAccessor({ name, type }: VisualChannelField, data: any): any;
721
729
 
722
730
  /** @privateRemarks Source: Builder */
@@ -738,19 +746,19 @@ type VisualChannelField = {
738
746
  };
739
747
  type VisualChannels = {
740
748
  colorField?: VisualChannelField;
741
- colorScale?: SCALE_TYPE;
749
+ colorScale?: ScaleType;
742
750
  customMarkersField?: VisualChannelField;
743
- customMarkersScale?: SCALE_TYPE;
751
+ customMarkersScale?: ScaleType;
744
752
  radiusField?: VisualChannelField;
745
- radiusScale?: SCALE_TYPE;
746
- rotationScale?: SCALE_TYPE;
753
+ radiusScale?: ScaleType;
754
+ rotationScale?: ScaleType;
747
755
  rotationField?: VisualChannelField;
748
756
  sizeField?: VisualChannelField;
749
- sizeScale?: SCALE_TYPE;
757
+ sizeScale?: ScaleType;
750
758
  strokeColorField?: VisualChannelField;
751
- strokeColorScale?: SCALE_TYPE;
759
+ strokeColorScale?: ScaleType;
752
760
  heightField?: VisualChannelField;
753
- heightScale?: SCALE_TYPE;
761
+ heightScale?: ScaleType;
754
762
  weightField?: VisualChannelField;
755
763
  };
756
764
  type ColorRange = {
@@ -931,10 +939,17 @@ declare const _default: {
931
939
  readonly DARK_MATTER_NOLABELS: string;
932
940
  };
933
941
 
942
+ type Scale = {
943
+ field: VisualChannelField;
944
+ domain: string[] | number[];
945
+ range: string[] | number[];
946
+ type: ScaleType;
947
+ };
934
948
  type LayerDescriptor = {
935
949
  type: LayerType;
936
950
  props: Record<string, any>;
937
951
  filters?: Filters;
952
+ scales: Record<ScaleKey, Scale>;
938
953
  };
939
954
  type ParseMapResult = {
940
955
  /** Map id. */
@@ -969,6 +984,7 @@ declare function parseMap(json: any): {
969
984
  token: any;
970
985
  layers: (LayerDescriptor | undefined)[];
971
986
  };
987
+ type ScaleKey = 'fillColor' | 'pointRadius' | 'lineColor' | 'elevation' | 'weight';
972
988
 
973
989
  type FetchMapOptions = {
974
990
  /**
@@ -1131,10 +1147,31 @@ interface BaseRequestOptions {
1131
1147
  filters?: Filters;
1132
1148
  filterOwner?: string;
1133
1149
  }
1134
- /** Options for {@link WidgetRemoteSource#getCategories}. */
1150
+ /**
1151
+ * Examples:
1152
+ * * population by state
1153
+ * * column: 'state'
1154
+ * * operation: 'sum'
1155
+ * * operationColumn: 'population'
1156
+ * * average salary by department
1157
+ * * column: 'department'
1158
+ * * operation: 'avg'
1159
+ * * operationColumn: 'salary'
1160
+ * * custom aggregation by storetype
1161
+ * * column: 'storetype'
1162
+ * * operation: 'custom'
1163
+ * * operationExp: 'sum(sales)/sum(area)'
1164
+ *
1165
+ * Options for {@link WidgetRemoteSource#getCategories}.
1166
+ */
1135
1167
  interface CategoryRequestOptions extends BaseRequestOptions {
1168
+ /** The column that to categorize by. */
1136
1169
  column: string;
1137
- operation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
1170
+ /** The type of aggregation to apply on data in scope of each category. */
1171
+ operation: AggregationType;
1172
+ /** Remote only. Only valid if operation is 'custom' */
1173
+ operationExp?: string;
1174
+ /** The aggregated column per each category. */
1138
1175
  operationColumn?: string;
1139
1176
  /** Local only. */
1140
1177
  joinOperation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
@@ -1176,11 +1213,28 @@ interface FeaturesRequestOptions extends BaseRequestOptions {
1176
1213
  */
1177
1214
  tileResolution?: TileResolution;
1178
1215
  }
1179
- /** Options for {@link WidgetRemoteSource#getFormula}. */
1216
+ /**
1217
+ * Examples:
1218
+ * * sum of all sales
1219
+ * * column: 'sales'
1220
+ * * operation: 'sum'
1221
+ * * average salary
1222
+ * * column: 'salary'
1223
+ * * operation: 'avg'
1224
+ * * custom aggregation over all rows
1225
+ * * operation: 'custom'
1226
+ * * operationExp: 'sum(sales)/sum(area)'
1227
+ *
1228
+ * Options for {@link WidgetRemoteSource#getFormula}.
1229
+ */
1180
1230
  interface FormulaRequestOptions extends BaseRequestOptions {
1181
- column: string;
1182
- operation?: 'count' | 'avg' | 'min' | 'max' | 'sum' | 'custom';
1231
+ /** The column to apply the aggregation operation on. Not needed for 'custom' operation. */
1232
+ column?: string;
1233
+ /** The type of aggregation to apply on data. */
1234
+ operation: AggregationType;
1235
+ /** Remote only. Only valid if operation is 'custom' */
1183
1236
  operationExp?: string;
1237
+ /** Local only. */
1184
1238
  joinOperation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
1185
1239
  }
1186
1240
  /** Options for {@link WidgetRemoteSource#getHistogram}. */
@@ -1215,12 +1269,25 @@ interface TableRequestOptions extends BaseRequestOptions {
1215
1269
  /** @deprecated Supported for tilesets only. Prefer `filters` (for all sources) instead. */
1216
1270
  searchFilterText?: string;
1217
1271
  }
1218
- /** Options for {@link WidgetRemoteSource#getTimeSeries}. */
1272
+ /**
1273
+ * Examples:
1274
+ * * sum of all sales by month
1275
+ * * column: 'sales'
1276
+ * * stepSize: 'month'
1277
+ * * operation: 'sum'
1278
+ * * average salary by year
1279
+ * * column: 'salary'
1280
+ * * stepSize: 'year'
1281
+ * * operation: 'avg'
1282
+ * Options for {@link WidgetRemoteSource#getTimeSeries}.
1283
+ */
1219
1284
  interface TimeSeriesRequestOptions extends BaseRequestOptions {
1220
1285
  column: string;
1221
1286
  stepSize: GroupDateType;
1222
1287
  stepMultiplier?: number;
1223
- operation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
1288
+ operation: AggregationType;
1289
+ /** Remote only. Only valid if operation is 'custom' */
1290
+ operationExp?: string;
1224
1291
  operationColumn?: string;
1225
1292
  joinOperation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
1226
1293
  splitByCategory?: string;
@@ -1818,4 +1885,4 @@ declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined
1818
1885
  */
1819
1886
  declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
1820
1887
 
1821
- 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 SchemaField, SchemaFieldType, 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, clearDefaultRequestCache, 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 };
1888
+ export { 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, type D3Scale, 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, SOURCE_DEFAULTS, type Scale, type ScaleKey, type ScaleType, type ScatterPlotFeature, type ScatterRequestOptions, type ScatterResponse, type SchemaField, SchemaFieldType, 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, clearDefaultRequestCache, clearFilters, configureSource, createPolygonSpatialFilter, createViewportSpatialFilter, fetchBasemapProps, fetchMap, filterFunctions, geojsonFeatures, getApplicableFilters, getClient, getColorAccessor, 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 };