@carto/api-client 0.5.15 → 0.5.16
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 +5 -0
- package/build/api-client.cjs +70 -1
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +33 -2
- package/build/api-client.d.ts +33 -2
- package/build/api-client.js +70 -1
- package/build/api-client.js.map +1 -1
- package/build/worker-compat.js +1395 -1276
- package/build/worker-compat.js.map +1 -1
- package/build/worker.js +34 -0
- package/build/worker.js.map +1 -1
- package/package.json +2 -2
- package/src/models/model.ts +1 -0
- package/src/widget-sources/types.ts +25 -0
- package/src/widget-sources/widget-remote-source.ts +30 -0
- package/src/widget-sources/widget-source.ts +11 -0
- package/src/widget-sources/widget-tileset-source-impl.ts +49 -0
- package/src/widget-sources/widget-tileset-source.ts +13 -0
- package/src/workers/constants.ts +1 -0
package/build/api-client.d.cts
CHANGED
|
@@ -1341,6 +1341,23 @@ interface TimeSeriesRequestOptions extends BaseRequestOptions {
|
|
|
1341
1341
|
splitByCategoryLimit?: number;
|
|
1342
1342
|
splitByCategoryValues?: string[];
|
|
1343
1343
|
}
|
|
1344
|
+
/**
|
|
1345
|
+
* Examples:
|
|
1346
|
+
* * aggregations with array syntax
|
|
1347
|
+
* * aggregations: [{column: 'pop_high', operation: 'sum', alias: 'high_pop'}, {column: 'pop_low', operation: 'avg'}]
|
|
1348
|
+
* * aggregations with string syntax
|
|
1349
|
+
* * aggregations: 'sum(pop_high) as high_pop, avg(pop_low) as avg_low'
|
|
1350
|
+
*
|
|
1351
|
+
* Options for {@link WidgetRemoteSource#getAggregations}.
|
|
1352
|
+
*/
|
|
1353
|
+
interface AggregationsRequestOptions extends BaseRequestOptions {
|
|
1354
|
+
/** Aggregations to compute. Can be an array of objects or a SQL string expression. */
|
|
1355
|
+
aggregations: {
|
|
1356
|
+
column: string;
|
|
1357
|
+
operation: Exclude<AggregationType, 'custom'>;
|
|
1358
|
+
alias: string;
|
|
1359
|
+
}[] | string;
|
|
1360
|
+
}
|
|
1344
1361
|
/** @experimental */
|
|
1345
1362
|
type ExtentRequestOptions = BaseRequestOptions;
|
|
1346
1363
|
/******************************************************************************
|
|
@@ -1396,6 +1413,10 @@ type TimeSeriesResponse = {
|
|
|
1396
1413
|
};
|
|
1397
1414
|
/** Response from {@link WidgetRemoteSource#getHistogram}. */
|
|
1398
1415
|
type HistogramResponse = number[];
|
|
1416
|
+
/** Response from {@link WidgetRemoteSource#getAggregations}. */
|
|
1417
|
+
type AggregationsResponse = {
|
|
1418
|
+
rows: Record<string, number | string | null>[];
|
|
1419
|
+
};
|
|
1399
1420
|
/** @experimental */
|
|
1400
1421
|
type ExtentResponse = {
|
|
1401
1422
|
bbox: BBox;
|
|
@@ -1468,6 +1489,12 @@ declare abstract class WidgetSource<Props extends WidgetSourceProps = WidgetSour
|
|
|
1468
1489
|
* time intervals. Suitable for rendering time series charts.
|
|
1469
1490
|
*/
|
|
1470
1491
|
abstract getTimeSeries(options: TimeSeriesRequestOptions): Promise<TimeSeriesResponse>;
|
|
1492
|
+
/**
|
|
1493
|
+
* Returns multiple aggregated values computed over matching data. Suitable
|
|
1494
|
+
* for aggregated statistics from pivoted tables, such as H3 tables with
|
|
1495
|
+
* pre-computed aggregations across multiple columns.
|
|
1496
|
+
*/
|
|
1497
|
+
abstract getAggregations(options: AggregationsRequestOptions): Promise<AggregationsResponse>;
|
|
1471
1498
|
/** @experimental */
|
|
1472
1499
|
abstract getExtent(options?: ExtentRequestOptions): Promise<ExtentResponse>;
|
|
1473
1500
|
}
|
|
@@ -1513,6 +1540,7 @@ declare abstract class WidgetRemoteSource<Props extends WidgetRemoteSourceProps>
|
|
|
1513
1540
|
getScatter(options: ScatterRequestOptions): Promise<ScatterResponse>;
|
|
1514
1541
|
getTable(options: TableRequestOptions): Promise<TableResponse>;
|
|
1515
1542
|
getTimeSeries(options: TimeSeriesRequestOptions): Promise<TimeSeriesResponse>;
|
|
1543
|
+
getAggregations(options: AggregationsRequestOptions): Promise<AggregationsResponse>;
|
|
1516
1544
|
/** @experimental */
|
|
1517
1545
|
getExtent(options?: ExtentRequestOptions): Promise<ExtentResponse>;
|
|
1518
1546
|
}
|
|
@@ -1630,7 +1658,8 @@ declare enum Method {
|
|
|
1630
1658
|
GET_SCATTER = "getScatter",
|
|
1631
1659
|
GET_TABLE = "getTable",
|
|
1632
1660
|
GET_TIME_SERIES = "getTimeSeries",
|
|
1633
|
-
GET_RANGE = "getRange"
|
|
1661
|
+
GET_RANGE = "getRange",
|
|
1662
|
+
GET_AGGREGATIONS = "getAggregations"
|
|
1634
1663
|
}
|
|
1635
1664
|
|
|
1636
1665
|
/**
|
|
@@ -1669,6 +1698,7 @@ declare class WidgetTilesetSourceImpl extends WidgetSource<WidgetTilesetSourcePr
|
|
|
1669
1698
|
getTable({ columns, searchFilterColumn, searchFilterText, sortBy, sortDirection, sortByColumnType, offset, limit, filters, filterOwner, spatialFilter, }: TableRequestOptions): Promise<TableResponse>;
|
|
1670
1699
|
getTimeSeries({ column, stepSize, operation, operationColumn, joinOperation, filters, filterOwner, spatialFilter, }: TimeSeriesRequestOptions): Promise<TimeSeriesResponse>;
|
|
1671
1700
|
getRange({ column, filters, filterOwner, spatialFilter, }: RangeRequestOptions): Promise<RangeResponse>;
|
|
1701
|
+
getAggregations({ aggregations, filters, filterOwner, spatialFilter, }: AggregationsRequestOptions): Promise<AggregationsResponse>;
|
|
1672
1702
|
/** @experimental */
|
|
1673
1703
|
getExtent(): Promise<ExtentResponse>;
|
|
1674
1704
|
/****************************************************************************
|
|
@@ -1749,6 +1779,7 @@ declare class WidgetTilesetSource<Props extends WidgetTilesetSourceProps = Widge
|
|
|
1749
1779
|
getTable({ signal, ...options }: TableRequestOptions): Promise<TableResponse>;
|
|
1750
1780
|
getTimeSeries({ signal, ...options }: TimeSeriesRequestOptions): Promise<TimeSeriesResponse>;
|
|
1751
1781
|
getRange({ signal, ...options }: RangeRequestOptions): Promise<RangeResponse>;
|
|
1782
|
+
getAggregations({ signal, ...options }: AggregationsRequestOptions): Promise<AggregationsResponse>;
|
|
1752
1783
|
/** @experimental */
|
|
1753
1784
|
getExtent(): Promise<ExtentResponse>;
|
|
1754
1785
|
}
|
|
@@ -2012,4 +2043,4 @@ declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined
|
|
|
2012
2043
|
*/
|
|
2013
2044
|
declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
|
|
2014
2045
|
|
|
2015
|
-
export { type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, AggregationTypes, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryOrderBy, type CategoryRequestOptions, type CategoryResponse, type CategoryResponseEntry, type CategoryResponseRaw, CellSet, type ColumnsOption, type D3Scale, DEFAULT_API_BASE_URL, type ExtentRequestOptions, type ExtentResponse, 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, OTHERS_CATEGORY_NAME, 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 TrajectoryQuerySourceOptions, type TrajectoryQuerySourceResponse, type TrajectoryTableSourceOptions, type TrajectoryTableSourceResponse, 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, getSorter, 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, trajectoryQuerySource, trajectoryTableSource, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
|
|
2046
|
+
export { type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, AggregationTypes, type AggregationsRequestOptions, type AggregationsResponse, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryOrderBy, type CategoryRequestOptions, type CategoryResponse, type CategoryResponseEntry, type CategoryResponseRaw, CellSet, type ColumnsOption, type D3Scale, DEFAULT_API_BASE_URL, type ExtentRequestOptions, type ExtentResponse, 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, OTHERS_CATEGORY_NAME, 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 TrajectoryQuerySourceOptions, type TrajectoryQuerySourceResponse, type TrajectoryTableSourceOptions, type TrajectoryTableSourceResponse, 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, getSorter, 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, trajectoryQuerySource, trajectoryTableSource, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
|
package/build/api-client.d.ts
CHANGED
|
@@ -1341,6 +1341,23 @@ interface TimeSeriesRequestOptions extends BaseRequestOptions {
|
|
|
1341
1341
|
splitByCategoryLimit?: number;
|
|
1342
1342
|
splitByCategoryValues?: string[];
|
|
1343
1343
|
}
|
|
1344
|
+
/**
|
|
1345
|
+
* Examples:
|
|
1346
|
+
* * aggregations with array syntax
|
|
1347
|
+
* * aggregations: [{column: 'pop_high', operation: 'sum', alias: 'high_pop'}, {column: 'pop_low', operation: 'avg'}]
|
|
1348
|
+
* * aggregations with string syntax
|
|
1349
|
+
* * aggregations: 'sum(pop_high) as high_pop, avg(pop_low) as avg_low'
|
|
1350
|
+
*
|
|
1351
|
+
* Options for {@link WidgetRemoteSource#getAggregations}.
|
|
1352
|
+
*/
|
|
1353
|
+
interface AggregationsRequestOptions extends BaseRequestOptions {
|
|
1354
|
+
/** Aggregations to compute. Can be an array of objects or a SQL string expression. */
|
|
1355
|
+
aggregations: {
|
|
1356
|
+
column: string;
|
|
1357
|
+
operation: Exclude<AggregationType, 'custom'>;
|
|
1358
|
+
alias: string;
|
|
1359
|
+
}[] | string;
|
|
1360
|
+
}
|
|
1344
1361
|
/** @experimental */
|
|
1345
1362
|
type ExtentRequestOptions = BaseRequestOptions;
|
|
1346
1363
|
/******************************************************************************
|
|
@@ -1396,6 +1413,10 @@ type TimeSeriesResponse = {
|
|
|
1396
1413
|
};
|
|
1397
1414
|
/** Response from {@link WidgetRemoteSource#getHistogram}. */
|
|
1398
1415
|
type HistogramResponse = number[];
|
|
1416
|
+
/** Response from {@link WidgetRemoteSource#getAggregations}. */
|
|
1417
|
+
type AggregationsResponse = {
|
|
1418
|
+
rows: Record<string, number | string | null>[];
|
|
1419
|
+
};
|
|
1399
1420
|
/** @experimental */
|
|
1400
1421
|
type ExtentResponse = {
|
|
1401
1422
|
bbox: BBox;
|
|
@@ -1468,6 +1489,12 @@ declare abstract class WidgetSource<Props extends WidgetSourceProps = WidgetSour
|
|
|
1468
1489
|
* time intervals. Suitable for rendering time series charts.
|
|
1469
1490
|
*/
|
|
1470
1491
|
abstract getTimeSeries(options: TimeSeriesRequestOptions): Promise<TimeSeriesResponse>;
|
|
1492
|
+
/**
|
|
1493
|
+
* Returns multiple aggregated values computed over matching data. Suitable
|
|
1494
|
+
* for aggregated statistics from pivoted tables, such as H3 tables with
|
|
1495
|
+
* pre-computed aggregations across multiple columns.
|
|
1496
|
+
*/
|
|
1497
|
+
abstract getAggregations(options: AggregationsRequestOptions): Promise<AggregationsResponse>;
|
|
1471
1498
|
/** @experimental */
|
|
1472
1499
|
abstract getExtent(options?: ExtentRequestOptions): Promise<ExtentResponse>;
|
|
1473
1500
|
}
|
|
@@ -1513,6 +1540,7 @@ declare abstract class WidgetRemoteSource<Props extends WidgetRemoteSourceProps>
|
|
|
1513
1540
|
getScatter(options: ScatterRequestOptions): Promise<ScatterResponse>;
|
|
1514
1541
|
getTable(options: TableRequestOptions): Promise<TableResponse>;
|
|
1515
1542
|
getTimeSeries(options: TimeSeriesRequestOptions): Promise<TimeSeriesResponse>;
|
|
1543
|
+
getAggregations(options: AggregationsRequestOptions): Promise<AggregationsResponse>;
|
|
1516
1544
|
/** @experimental */
|
|
1517
1545
|
getExtent(options?: ExtentRequestOptions): Promise<ExtentResponse>;
|
|
1518
1546
|
}
|
|
@@ -1630,7 +1658,8 @@ declare enum Method {
|
|
|
1630
1658
|
GET_SCATTER = "getScatter",
|
|
1631
1659
|
GET_TABLE = "getTable",
|
|
1632
1660
|
GET_TIME_SERIES = "getTimeSeries",
|
|
1633
|
-
GET_RANGE = "getRange"
|
|
1661
|
+
GET_RANGE = "getRange",
|
|
1662
|
+
GET_AGGREGATIONS = "getAggregations"
|
|
1634
1663
|
}
|
|
1635
1664
|
|
|
1636
1665
|
/**
|
|
@@ -1669,6 +1698,7 @@ declare class WidgetTilesetSourceImpl extends WidgetSource<WidgetTilesetSourcePr
|
|
|
1669
1698
|
getTable({ columns, searchFilterColumn, searchFilterText, sortBy, sortDirection, sortByColumnType, offset, limit, filters, filterOwner, spatialFilter, }: TableRequestOptions): Promise<TableResponse>;
|
|
1670
1699
|
getTimeSeries({ column, stepSize, operation, operationColumn, joinOperation, filters, filterOwner, spatialFilter, }: TimeSeriesRequestOptions): Promise<TimeSeriesResponse>;
|
|
1671
1700
|
getRange({ column, filters, filterOwner, spatialFilter, }: RangeRequestOptions): Promise<RangeResponse>;
|
|
1701
|
+
getAggregations({ aggregations, filters, filterOwner, spatialFilter, }: AggregationsRequestOptions): Promise<AggregationsResponse>;
|
|
1672
1702
|
/** @experimental */
|
|
1673
1703
|
getExtent(): Promise<ExtentResponse>;
|
|
1674
1704
|
/****************************************************************************
|
|
@@ -1749,6 +1779,7 @@ declare class WidgetTilesetSource<Props extends WidgetTilesetSourceProps = Widge
|
|
|
1749
1779
|
getTable({ signal, ...options }: TableRequestOptions): Promise<TableResponse>;
|
|
1750
1780
|
getTimeSeries({ signal, ...options }: TimeSeriesRequestOptions): Promise<TimeSeriesResponse>;
|
|
1751
1781
|
getRange({ signal, ...options }: RangeRequestOptions): Promise<RangeResponse>;
|
|
1782
|
+
getAggregations({ signal, ...options }: AggregationsRequestOptions): Promise<AggregationsResponse>;
|
|
1752
1783
|
/** @experimental */
|
|
1753
1784
|
getExtent(): Promise<ExtentResponse>;
|
|
1754
1785
|
}
|
|
@@ -2012,4 +2043,4 @@ declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined
|
|
|
2012
2043
|
*/
|
|
2013
2044
|
declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
|
|
2014
2045
|
|
|
2015
|
-
export { type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, AggregationTypes, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryOrderBy, type CategoryRequestOptions, type CategoryResponse, type CategoryResponseEntry, type CategoryResponseRaw, CellSet, type ColumnsOption, type D3Scale, DEFAULT_API_BASE_URL, type ExtentRequestOptions, type ExtentResponse, 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, OTHERS_CATEGORY_NAME, 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 TrajectoryQuerySourceOptions, type TrajectoryQuerySourceResponse, type TrajectoryTableSourceOptions, type TrajectoryTableSourceResponse, 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, getSorter, 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, trajectoryQuerySource, trajectoryTableSource, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
|
|
2046
|
+
export { type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, AggregationTypes, type AggregationsRequestOptions, type AggregationsResponse, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryOrderBy, type CategoryRequestOptions, type CategoryResponse, type CategoryResponseEntry, type CategoryResponseRaw, CellSet, type ColumnsOption, type D3Scale, DEFAULT_API_BASE_URL, type ExtentRequestOptions, type ExtentResponse, 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, OTHERS_CATEGORY_NAME, 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 TrajectoryQuerySourceOptions, type TrajectoryQuerySourceResponse, type TrajectoryTableSourceOptions, type TrajectoryTableSourceResponse, 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, getSorter, 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, trajectoryQuerySource, trajectoryTableSource, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
|
package/build/api-client.js
CHANGED
|
@@ -6152,7 +6152,8 @@ var AVAILABLE_MODELS = [
|
|
|
6152
6152
|
"timeseries",
|
|
6153
6153
|
"range",
|
|
6154
6154
|
"scatterplot",
|
|
6155
|
-
"table"
|
|
6155
|
+
"table",
|
|
6156
|
+
"aggregations"
|
|
6156
6157
|
];
|
|
6157
6158
|
var { V3 } = ApiVersion;
|
|
6158
6159
|
var REQUEST_GET_MAX_URL_LENGTH = 2048;
|
|
@@ -6593,6 +6594,30 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
6593
6594
|
categories: res.metadata?.categories
|
|
6594
6595
|
}));
|
|
6595
6596
|
}
|
|
6597
|
+
async getAggregations(options) {
|
|
6598
|
+
const {
|
|
6599
|
+
signal,
|
|
6600
|
+
filters = this.props.filters,
|
|
6601
|
+
filterOwner,
|
|
6602
|
+
spatialFilter,
|
|
6603
|
+
spatialFiltersMode,
|
|
6604
|
+
aggregations
|
|
6605
|
+
} = options;
|
|
6606
|
+
return executeModel({
|
|
6607
|
+
model: "aggregations",
|
|
6608
|
+
source: {
|
|
6609
|
+
...this.getModelSource(filters, filterOwner),
|
|
6610
|
+
spatialFiltersMode,
|
|
6611
|
+
spatialFilter
|
|
6612
|
+
},
|
|
6613
|
+
params: {
|
|
6614
|
+
aggregations
|
|
6615
|
+
},
|
|
6616
|
+
opts: { signal, headers: this.props.headers }
|
|
6617
|
+
}).then((res) => ({
|
|
6618
|
+
rows: res.rows.map((row) => normalizeObjectKeys(row))
|
|
6619
|
+
}));
|
|
6620
|
+
}
|
|
6596
6621
|
/** @experimental */
|
|
6597
6622
|
async getExtent(options = {}) {
|
|
6598
6623
|
const { signal, filters = this.props.filters, filterOwner } = options;
|
|
@@ -7392,6 +7417,7 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
|
|
|
7392
7417
|
assertColumn(this._features, column);
|
|
7393
7418
|
}
|
|
7394
7419
|
const targetOperation = aggregationFunctions[operation2];
|
|
7420
|
+
assert2(targetOperation, `Unsupported aggregation operation: ${operation2}`);
|
|
7395
7421
|
return {
|
|
7396
7422
|
value: targetOperation(filteredFeatures, column, joinOperation)
|
|
7397
7423
|
};
|
|
@@ -7590,6 +7616,39 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
|
|
|
7590
7616
|
max: aggregationFunctions.max(filteredFeatures, column)
|
|
7591
7617
|
};
|
|
7592
7618
|
}
|
|
7619
|
+
async getAggregations({
|
|
7620
|
+
aggregations,
|
|
7621
|
+
filters,
|
|
7622
|
+
filterOwner,
|
|
7623
|
+
spatialFilter
|
|
7624
|
+
}) {
|
|
7625
|
+
const filteredFeatures = this._getFilteredFeatures(
|
|
7626
|
+
spatialFilter,
|
|
7627
|
+
filters,
|
|
7628
|
+
filterOwner
|
|
7629
|
+
);
|
|
7630
|
+
if (!this._features.length) {
|
|
7631
|
+
return { rows: [] };
|
|
7632
|
+
}
|
|
7633
|
+
assert2(
|
|
7634
|
+
typeof aggregations !== "string",
|
|
7635
|
+
"Unsupported tileset SQL aggregation"
|
|
7636
|
+
);
|
|
7637
|
+
const result = {};
|
|
7638
|
+
const usedAliases = /* @__PURE__ */ new Set();
|
|
7639
|
+
for (const { column, operation: operation2, alias } of aggregations) {
|
|
7640
|
+
if (column && column !== "*" || operation2 !== AggregationTypes.Count) {
|
|
7641
|
+
assertColumn(this._features, column);
|
|
7642
|
+
}
|
|
7643
|
+
const aliasKey = alias.toLowerCase();
|
|
7644
|
+
assert2(!usedAliases.has(aliasKey), `Duplicate alias: ${aliasKey}`);
|
|
7645
|
+
usedAliases.add(aliasKey);
|
|
7646
|
+
const targetOperation = aggregationFunctions[operation2];
|
|
7647
|
+
assert2(targetOperation, `Unsupported operation: ${operation2}`);
|
|
7648
|
+
result[alias] = targetOperation(filteredFeatures, column);
|
|
7649
|
+
}
|
|
7650
|
+
return { rows: [result] };
|
|
7651
|
+
}
|
|
7593
7652
|
/** @experimental */
|
|
7594
7653
|
async getExtent() {
|
|
7595
7654
|
return Promise.reject(new Error("not implemented"));
|
|
@@ -7824,6 +7883,16 @@ var WidgetTilesetSource = class extends WidgetSource {
|
|
|
7824
7883
|
}) {
|
|
7825
7884
|
return this._executeWorkerMethod("getRange" /* GET_RANGE */, [options], signal);
|
|
7826
7885
|
}
|
|
7886
|
+
async getAggregations({
|
|
7887
|
+
signal,
|
|
7888
|
+
...options
|
|
7889
|
+
}) {
|
|
7890
|
+
return this._executeWorkerMethod(
|
|
7891
|
+
"getAggregations" /* GET_AGGREGATIONS */,
|
|
7892
|
+
[options],
|
|
7893
|
+
signal
|
|
7894
|
+
);
|
|
7895
|
+
}
|
|
7827
7896
|
/** @experimental */
|
|
7828
7897
|
async getExtent() {
|
|
7829
7898
|
return Promise.resolve({
|