@carto/api-client 0.5.7-alpha.1 → 0.5.7-alpha.3
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/build/api-client.cjs +32 -11
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +14 -6
- package/build/api-client.d.ts +14 -6
- package/build/api-client.js +28 -11
- package/build/api-client.js.map +1 -1
- package/build/worker-compat.js +25 -9
- package/build/worker-compat.js.map +1 -1
- package/build/worker.js +25 -9
- package/build/worker.js.map +1 -1
- package/package.json +1 -1
- package/src/operations/groupBy.ts +24 -6
- package/src/widget-sources/constants.ts +6 -0
- package/src/widget-sources/index.ts +1 -0
- package/src/widget-sources/types.ts +3 -3
- package/src/widget-sources/widget-remote-source.ts +3 -2
- package/src/widget-sources/widget-tileset-source-impl.ts +2 -0
package/build/api-client.d.cts
CHANGED
|
@@ -1193,8 +1193,8 @@ interface CategoryRequestOptions extends BaseRequestOptions {
|
|
|
1193
1193
|
operationColumn?: string;
|
|
1194
1194
|
/** Local only. */
|
|
1195
1195
|
joinOperation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
|
|
1196
|
-
/**
|
|
1197
|
-
|
|
1196
|
+
/** Calculate `_carto_others` category for all categories after first N (N is threshold). */
|
|
1197
|
+
othersThreshold?: number;
|
|
1198
1198
|
}
|
|
1199
1199
|
/**
|
|
1200
1200
|
* Options for {@link WidgetRemoteSource#getFeatures}.
|
|
@@ -1331,7 +1331,7 @@ type FormulaResponse = {
|
|
|
1331
1331
|
};
|
|
1332
1332
|
/** Response from {@link WidgetRemoteSource#getCategories}. */
|
|
1333
1333
|
type CategoryResponse = {
|
|
1334
|
-
name: string;
|
|
1334
|
+
name: string | null;
|
|
1335
1335
|
value: number;
|
|
1336
1336
|
}[];
|
|
1337
1337
|
/** Response from {@link WidgetRemoteSource#getRange}. */
|
|
@@ -1615,7 +1615,7 @@ declare class WidgetTilesetSourceImpl extends WidgetSource<WidgetTilesetSourcePr
|
|
|
1615
1615
|
getFeatures(): Promise<FeaturesResponse>;
|
|
1616
1616
|
getFormula({ column, operation, joinOperation, filters, filterOwner, spatialFilter, }: FormulaRequestOptions): Promise<FormulaResponse>;
|
|
1617
1617
|
getHistogram({ operation, ticks, column, joinOperation, filters, filterOwner, spatialFilter, }: HistogramRequestOptions): Promise<HistogramResponse>;
|
|
1618
|
-
getCategories({ column, operation, operationColumn, joinOperation, filters, filterOwner, spatialFilter, }: CategoryRequestOptions): Promise<CategoryResponse>;
|
|
1618
|
+
getCategories({ column, operation, operationColumn, joinOperation, filters, filterOwner, spatialFilter, othersThreshold, }: CategoryRequestOptions): Promise<CategoryResponse>;
|
|
1619
1619
|
getScatter({ xAxisColumn, yAxisColumn, xAxisJoinOperation, yAxisJoinOperation, filters, filterOwner, spatialFilter, }: ScatterRequestOptions): Promise<ScatterResponse>;
|
|
1620
1620
|
getTable({ columns, searchFilterColumn, searchFilterText, sortBy, sortDirection, sortByColumnType, offset, limit, filters, filterOwner, spatialFilter, }: TableRequestOptions): Promise<TableResponse>;
|
|
1621
1621
|
getTimeSeries({ column, stepSize, operation, operationColumn, joinOperation, filters, filterOwner, spatialFilter, }: TimeSeriesRequestOptions): Promise<TimeSeriesResponse>;
|
|
@@ -1736,6 +1736,13 @@ declare class WidgetTableSource extends WidgetRemoteSource<LayerTableSourceOptio
|
|
|
1736
1736
|
protected getModelSource(filters: Filters | undefined, filterOwner?: string): ModelSource;
|
|
1737
1737
|
}
|
|
1738
1738
|
|
|
1739
|
+
/**
|
|
1740
|
+
* Name of the category that represents the "Others" category.
|
|
1741
|
+
*
|
|
1742
|
+
* See `WidgetSource.getCategories` for more information.
|
|
1743
|
+
*/
|
|
1744
|
+
declare const OTHERS_CATEGORY_NAME = "_carto_others";
|
|
1745
|
+
|
|
1739
1746
|
type H3QuerySourceOptions = SourceOptions & QuerySourceOptions & AggregationOptions & FilterOptions;
|
|
1740
1747
|
type H3QuerySourceResponse = TilejsonResult & WidgetQuerySourceResult;
|
|
1741
1748
|
declare const h3QuerySource: (options: H3QuerySourceOptions) => Promise<H3QuerySourceResponse>;
|
|
@@ -1819,12 +1826,13 @@ type GroupByFeature = {
|
|
|
1819
1826
|
value: number;
|
|
1820
1827
|
}[];
|
|
1821
1828
|
/** @privateRemarks Source: @carto/react-core */
|
|
1822
|
-
declare function groupValuesByColumn({ data, valuesColumns, joinOperation, keysColumn, operation, }: {
|
|
1829
|
+
declare function groupValuesByColumn({ data, valuesColumns, joinOperation, keysColumn, operation, othersThreshold, }: {
|
|
1823
1830
|
data: FeatureData[];
|
|
1824
1831
|
valuesColumns?: string[];
|
|
1825
1832
|
joinOperation?: AggregationType;
|
|
1826
1833
|
keysColumn: string;
|
|
1827
1834
|
operation: AggregationType;
|
|
1835
|
+
othersThreshold?: number;
|
|
1828
1836
|
}): GroupByFeature | null;
|
|
1829
1837
|
|
|
1830
1838
|
/** @privateRemarks Source: @carto/react-core */
|
|
@@ -1905,4 +1913,4 @@ declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined
|
|
|
1905
1913
|
*/
|
|
1906
1914
|
declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
|
|
1907
1915
|
|
|
1908
|
-
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 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 };
|
|
1916
|
+
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 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, 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 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 };
|
package/build/api-client.d.ts
CHANGED
|
@@ -1193,8 +1193,8 @@ interface CategoryRequestOptions extends BaseRequestOptions {
|
|
|
1193
1193
|
operationColumn?: string;
|
|
1194
1194
|
/** Local only. */
|
|
1195
1195
|
joinOperation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
|
|
1196
|
-
/**
|
|
1197
|
-
|
|
1196
|
+
/** Calculate `_carto_others` category for all categories after first N (N is threshold). */
|
|
1197
|
+
othersThreshold?: number;
|
|
1198
1198
|
}
|
|
1199
1199
|
/**
|
|
1200
1200
|
* Options for {@link WidgetRemoteSource#getFeatures}.
|
|
@@ -1331,7 +1331,7 @@ type FormulaResponse = {
|
|
|
1331
1331
|
};
|
|
1332
1332
|
/** Response from {@link WidgetRemoteSource#getCategories}. */
|
|
1333
1333
|
type CategoryResponse = {
|
|
1334
|
-
name: string;
|
|
1334
|
+
name: string | null;
|
|
1335
1335
|
value: number;
|
|
1336
1336
|
}[];
|
|
1337
1337
|
/** Response from {@link WidgetRemoteSource#getRange}. */
|
|
@@ -1615,7 +1615,7 @@ declare class WidgetTilesetSourceImpl extends WidgetSource<WidgetTilesetSourcePr
|
|
|
1615
1615
|
getFeatures(): Promise<FeaturesResponse>;
|
|
1616
1616
|
getFormula({ column, operation, joinOperation, filters, filterOwner, spatialFilter, }: FormulaRequestOptions): Promise<FormulaResponse>;
|
|
1617
1617
|
getHistogram({ operation, ticks, column, joinOperation, filters, filterOwner, spatialFilter, }: HistogramRequestOptions): Promise<HistogramResponse>;
|
|
1618
|
-
getCategories({ column, operation, operationColumn, joinOperation, filters, filterOwner, spatialFilter, }: CategoryRequestOptions): Promise<CategoryResponse>;
|
|
1618
|
+
getCategories({ column, operation, operationColumn, joinOperation, filters, filterOwner, spatialFilter, othersThreshold, }: CategoryRequestOptions): Promise<CategoryResponse>;
|
|
1619
1619
|
getScatter({ xAxisColumn, yAxisColumn, xAxisJoinOperation, yAxisJoinOperation, filters, filterOwner, spatialFilter, }: ScatterRequestOptions): Promise<ScatterResponse>;
|
|
1620
1620
|
getTable({ columns, searchFilterColumn, searchFilterText, sortBy, sortDirection, sortByColumnType, offset, limit, filters, filterOwner, spatialFilter, }: TableRequestOptions): Promise<TableResponse>;
|
|
1621
1621
|
getTimeSeries({ column, stepSize, operation, operationColumn, joinOperation, filters, filterOwner, spatialFilter, }: TimeSeriesRequestOptions): Promise<TimeSeriesResponse>;
|
|
@@ -1736,6 +1736,13 @@ declare class WidgetTableSource extends WidgetRemoteSource<LayerTableSourceOptio
|
|
|
1736
1736
|
protected getModelSource(filters: Filters | undefined, filterOwner?: string): ModelSource;
|
|
1737
1737
|
}
|
|
1738
1738
|
|
|
1739
|
+
/**
|
|
1740
|
+
* Name of the category that represents the "Others" category.
|
|
1741
|
+
*
|
|
1742
|
+
* See `WidgetSource.getCategories` for more information.
|
|
1743
|
+
*/
|
|
1744
|
+
declare const OTHERS_CATEGORY_NAME = "_carto_others";
|
|
1745
|
+
|
|
1739
1746
|
type H3QuerySourceOptions = SourceOptions & QuerySourceOptions & AggregationOptions & FilterOptions;
|
|
1740
1747
|
type H3QuerySourceResponse = TilejsonResult & WidgetQuerySourceResult;
|
|
1741
1748
|
declare const h3QuerySource: (options: H3QuerySourceOptions) => Promise<H3QuerySourceResponse>;
|
|
@@ -1819,12 +1826,13 @@ type GroupByFeature = {
|
|
|
1819
1826
|
value: number;
|
|
1820
1827
|
}[];
|
|
1821
1828
|
/** @privateRemarks Source: @carto/react-core */
|
|
1822
|
-
declare function groupValuesByColumn({ data, valuesColumns, joinOperation, keysColumn, operation, }: {
|
|
1829
|
+
declare function groupValuesByColumn({ data, valuesColumns, joinOperation, keysColumn, operation, othersThreshold, }: {
|
|
1823
1830
|
data: FeatureData[];
|
|
1824
1831
|
valuesColumns?: string[];
|
|
1825
1832
|
joinOperation?: AggregationType;
|
|
1826
1833
|
keysColumn: string;
|
|
1827
1834
|
operation: AggregationType;
|
|
1835
|
+
othersThreshold?: number;
|
|
1828
1836
|
}): GroupByFeature | null;
|
|
1829
1837
|
|
|
1830
1838
|
/** @privateRemarks Source: @carto/react-core */
|
|
@@ -1905,4 +1913,4 @@ declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined
|
|
|
1905
1913
|
*/
|
|
1906
1914
|
declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
|
|
1907
1915
|
|
|
1908
|
-
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 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 };
|
|
1916
|
+
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 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, 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 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 };
|
package/build/api-client.js
CHANGED
|
@@ -6271,7 +6271,7 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
6271
6271
|
spatialFiltersMode,
|
|
6272
6272
|
...params
|
|
6273
6273
|
} = options;
|
|
6274
|
-
const { column, operation: operation2, operationColumn, operationExp,
|
|
6274
|
+
const { column, operation: operation2, operationColumn, operationExp, othersThreshold } = params;
|
|
6275
6275
|
if (operation2 === AggregationTypes.Custom) {
|
|
6276
6276
|
assert2(operationExp, "operationExp is required for custom operation");
|
|
6277
6277
|
}
|
|
@@ -6287,7 +6287,7 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
6287
6287
|
operation: operation2,
|
|
6288
6288
|
operationExp,
|
|
6289
6289
|
operationColumn: operationColumn || column,
|
|
6290
|
-
|
|
6290
|
+
othersThreshold
|
|
6291
6291
|
},
|
|
6292
6292
|
opts: { signal, headers: this.props.headers }
|
|
6293
6293
|
}).then((res) => normalizeObjectKeys(res.rows));
|
|
@@ -6677,13 +6677,17 @@ function normalizeSortByOptions({
|
|
|
6677
6677
|
});
|
|
6678
6678
|
}
|
|
6679
6679
|
|
|
6680
|
+
// src/widget-sources/constants.ts
|
|
6681
|
+
var OTHERS_CATEGORY_NAME = "_carto_others";
|
|
6682
|
+
|
|
6680
6683
|
// src/operations/groupBy.ts
|
|
6681
6684
|
function groupValuesByColumn({
|
|
6682
6685
|
data,
|
|
6683
6686
|
valuesColumns,
|
|
6684
6687
|
joinOperation,
|
|
6685
6688
|
keysColumn,
|
|
6686
|
-
operation: operation2
|
|
6689
|
+
operation: operation2,
|
|
6690
|
+
othersThreshold
|
|
6687
6691
|
}) {
|
|
6688
6692
|
if (Array.isArray(data) && data.length === 0) {
|
|
6689
6693
|
return null;
|
|
@@ -6701,13 +6705,23 @@ function groupValuesByColumn({
|
|
|
6701
6705
|
return accumulator;
|
|
6702
6706
|
}, /* @__PURE__ */ new Map());
|
|
6703
6707
|
const targetOperation = aggregationFunctions[operation2];
|
|
6704
|
-
if (targetOperation) {
|
|
6705
|
-
return
|
|
6706
|
-
name,
|
|
6707
|
-
value: targetOperation(value)
|
|
6708
|
-
}));
|
|
6708
|
+
if (!targetOperation) {
|
|
6709
|
+
return [];
|
|
6709
6710
|
}
|
|
6710
|
-
|
|
6711
|
+
const allCategories = Array.from(groups).map(([name, value]) => ({
|
|
6712
|
+
name,
|
|
6713
|
+
value: targetOperation(value)
|
|
6714
|
+
}));
|
|
6715
|
+
allCategories.sort((a, b) => b.value - a.value);
|
|
6716
|
+
if (othersThreshold && allCategories.length > othersThreshold) {
|
|
6717
|
+
const otherNames = allCategories.map((entry) => entry.name).slice(othersThreshold);
|
|
6718
|
+
const otherValue = otherNames.flatMap((name) => groups.get(name));
|
|
6719
|
+
allCategories.push({
|
|
6720
|
+
name: OTHERS_CATEGORY_NAME,
|
|
6721
|
+
value: targetOperation(otherValue)
|
|
6722
|
+
});
|
|
6723
|
+
}
|
|
6724
|
+
return allCategories;
|
|
6711
6725
|
}
|
|
6712
6726
|
|
|
6713
6727
|
// src/utils/dateUtils.ts
|
|
@@ -7270,7 +7284,8 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
|
|
|
7270
7284
|
joinOperation,
|
|
7271
7285
|
filters,
|
|
7272
7286
|
filterOwner,
|
|
7273
|
-
spatialFilter
|
|
7287
|
+
spatialFilter,
|
|
7288
|
+
othersThreshold
|
|
7274
7289
|
}) {
|
|
7275
7290
|
const filteredFeatures = this._getFilteredFeatures(
|
|
7276
7291
|
spatialFilter,
|
|
@@ -7286,7 +7301,8 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
|
|
|
7286
7301
|
valuesColumns: normalizeColumns(operationColumn || column),
|
|
7287
7302
|
joinOperation,
|
|
7288
7303
|
keysColumn: column,
|
|
7289
|
-
operation: operation2
|
|
7304
|
+
operation: operation2,
|
|
7305
|
+
othersThreshold
|
|
7290
7306
|
});
|
|
7291
7307
|
return groups || [];
|
|
7292
7308
|
}
|
|
@@ -9973,6 +9989,7 @@ export {
|
|
|
9973
9989
|
FEATURE_GEOM_PROPERTY,
|
|
9974
9990
|
FilterType,
|
|
9975
9991
|
OPACITY_MAP,
|
|
9992
|
+
OTHERS_CATEGORY_NAME,
|
|
9976
9993
|
Provider,
|
|
9977
9994
|
SOURCE_DEFAULTS,
|
|
9978
9995
|
SchemaFieldType,
|