@carto/api-client 0.5.7-alpha.3 → 0.5.7-alpha.5
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 +73 -34
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +22 -14
- package/build/api-client.d.ts +22 -14
- package/build/api-client.js +71 -30
- package/build/api-client.js.map +1 -1
- package/build/worker-compat.js +3476 -2303
- package/build/worker-compat.js.map +1 -1
- package/build/worker.js +68 -26
- package/build/worker.js.map +1 -1
- package/package.json +2 -2
- package/src/filters/tileFeaturesRaster.ts +2 -1
- package/src/index.ts +1 -0
- package/src/operations/groupBy.ts +6 -24
- package/src/utils/CellSet.ts +90 -0
- package/src/widget-sources/index.ts +0 -1
- package/src/widget-sources/types.ts +1 -3
- package/src/widget-sources/widget-remote-source.ts +1 -3
- package/src/widget-sources/widget-tileset-source-impl.ts +0 -2
- package/src/widget-sources/constants.ts +0 -6
package/build/api-client.d.cts
CHANGED
|
@@ -1193,8 +1193,6 @@ interface CategoryRequestOptions extends BaseRequestOptions {
|
|
|
1193
1193
|
operationColumn?: string;
|
|
1194
1194
|
/** Local only. */
|
|
1195
1195
|
joinOperation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
|
|
1196
|
-
/** Calculate `_carto_others` category for all categories after first N (N is threshold). */
|
|
1197
|
-
othersThreshold?: number;
|
|
1198
1196
|
}
|
|
1199
1197
|
/**
|
|
1200
1198
|
* Options for {@link WidgetRemoteSource#getFeatures}.
|
|
@@ -1331,7 +1329,7 @@ type FormulaResponse = {
|
|
|
1331
1329
|
};
|
|
1332
1330
|
/** Response from {@link WidgetRemoteSource#getCategories}. */
|
|
1333
1331
|
type CategoryResponse = {
|
|
1334
|
-
name: string
|
|
1332
|
+
name: string;
|
|
1335
1333
|
value: number;
|
|
1336
1334
|
}[];
|
|
1337
1335
|
/** Response from {@link WidgetRemoteSource#getRange}. */
|
|
@@ -1615,7 +1613,7 @@ declare class WidgetTilesetSourceImpl extends WidgetSource<WidgetTilesetSourcePr
|
|
|
1615
1613
|
getFeatures(): Promise<FeaturesResponse>;
|
|
1616
1614
|
getFormula({ column, operation, joinOperation, filters, filterOwner, spatialFilter, }: FormulaRequestOptions): Promise<FormulaResponse>;
|
|
1617
1615
|
getHistogram({ operation, ticks, column, joinOperation, filters, filterOwner, spatialFilter, }: HistogramRequestOptions): Promise<HistogramResponse>;
|
|
1618
|
-
getCategories({ column, operation, operationColumn, joinOperation, filters, filterOwner, spatialFilter,
|
|
1616
|
+
getCategories({ column, operation, operationColumn, joinOperation, filters, filterOwner, spatialFilter, }: CategoryRequestOptions): Promise<CategoryResponse>;
|
|
1619
1617
|
getScatter({ xAxisColumn, yAxisColumn, xAxisJoinOperation, yAxisJoinOperation, filters, filterOwner, spatialFilter, }: ScatterRequestOptions): Promise<ScatterResponse>;
|
|
1620
1618
|
getTable({ columns, searchFilterColumn, searchFilterText, sortBy, sortDirection, sortByColumnType, offset, limit, filters, filterOwner, spatialFilter, }: TableRequestOptions): Promise<TableResponse>;
|
|
1621
1619
|
getTimeSeries({ column, stepSize, operation, operationColumn, joinOperation, filters, filterOwner, spatialFilter, }: TimeSeriesRequestOptions): Promise<TimeSeriesResponse>;
|
|
@@ -1736,13 +1734,6 @@ declare class WidgetTableSource extends WidgetRemoteSource<LayerTableSourceOptio
|
|
|
1736
1734
|
protected getModelSource(filters: Filters | undefined, filterOwner?: string): ModelSource;
|
|
1737
1735
|
}
|
|
1738
1736
|
|
|
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
|
-
|
|
1746
1737
|
type H3QuerySourceOptions = SourceOptions & QuerySourceOptions & AggregationOptions & FilterOptions;
|
|
1747
1738
|
type H3QuerySourceResponse = TilejsonResult & WidgetQuerySourceResult;
|
|
1748
1739
|
declare const h3QuerySource: (options: H3QuerySourceOptions) => Promise<H3QuerySourceResponse>;
|
|
@@ -1826,13 +1817,12 @@ type GroupByFeature = {
|
|
|
1826
1817
|
value: number;
|
|
1827
1818
|
}[];
|
|
1828
1819
|
/** @privateRemarks Source: @carto/react-core */
|
|
1829
|
-
declare function groupValuesByColumn({ data, valuesColumns, joinOperation, keysColumn, operation,
|
|
1820
|
+
declare function groupValuesByColumn({ data, valuesColumns, joinOperation, keysColumn, operation, }: {
|
|
1830
1821
|
data: FeatureData[];
|
|
1831
1822
|
valuesColumns?: string[];
|
|
1832
1823
|
joinOperation?: AggregationType;
|
|
1833
1824
|
keysColumn: string;
|
|
1834
1825
|
operation: AggregationType;
|
|
1835
|
-
othersThreshold?: number;
|
|
1836
1826
|
}): GroupByFeature | null;
|
|
1837
1827
|
|
|
1838
1828
|
/** @privateRemarks Source: @carto/react-core */
|
|
@@ -1881,6 +1871,24 @@ declare function makeIntervalComplete(intervals: FilterInterval[]): FilterInterv
|
|
|
1881
1871
|
*/
|
|
1882
1872
|
declare function transformToTileCoords<T extends Geometry>(geometry: T, bbox: BBox): T;
|
|
1883
1873
|
|
|
1874
|
+
/**
|
|
1875
|
+
* Custom Set-like interface optimized for BigUint64 cell IDs. Unlike Set,
|
|
1876
|
+
* limited in most JavaScript runtimes to ~16M entries, this implementation
|
|
1877
|
+
* can support up to `n = 2^32 - 1` (4 billion) entries, with lookups in
|
|
1878
|
+
* amortized O(1) time.
|
|
1879
|
+
*/
|
|
1880
|
+
declare class CellSet {
|
|
1881
|
+
/** List of cells stored by the set. Stored by reference, without copying. */
|
|
1882
|
+
private cells;
|
|
1883
|
+
/** DataView representing a single cell ID. Pre-allocated to reduce memory during queries. */
|
|
1884
|
+
private cellView;
|
|
1885
|
+
/** Hash table, mapping a hash index (computed) to an index in the 'cells' array. */
|
|
1886
|
+
private hashTable;
|
|
1887
|
+
constructor(cells: bigint[]);
|
|
1888
|
+
has(cell: bigint): boolean;
|
|
1889
|
+
private hashLookup;
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1884
1892
|
type FetchDatasetOptions = {
|
|
1885
1893
|
accessToken: string;
|
|
1886
1894
|
apiBaseUrl: string;
|
|
@@ -1913,4 +1921,4 @@ declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined
|
|
|
1913
1921
|
*/
|
|
1914
1922
|
declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
|
|
1915
1923
|
|
|
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,
|
|
1924
|
+
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, CellSet, 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 };
|
package/build/api-client.d.ts
CHANGED
|
@@ -1193,8 +1193,6 @@ interface CategoryRequestOptions extends BaseRequestOptions {
|
|
|
1193
1193
|
operationColumn?: string;
|
|
1194
1194
|
/** Local only. */
|
|
1195
1195
|
joinOperation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
|
|
1196
|
-
/** Calculate `_carto_others` category for all categories after first N (N is threshold). */
|
|
1197
|
-
othersThreshold?: number;
|
|
1198
1196
|
}
|
|
1199
1197
|
/**
|
|
1200
1198
|
* Options for {@link WidgetRemoteSource#getFeatures}.
|
|
@@ -1331,7 +1329,7 @@ type FormulaResponse = {
|
|
|
1331
1329
|
};
|
|
1332
1330
|
/** Response from {@link WidgetRemoteSource#getCategories}. */
|
|
1333
1331
|
type CategoryResponse = {
|
|
1334
|
-
name: string
|
|
1332
|
+
name: string;
|
|
1335
1333
|
value: number;
|
|
1336
1334
|
}[];
|
|
1337
1335
|
/** Response from {@link WidgetRemoteSource#getRange}. */
|
|
@@ -1615,7 +1613,7 @@ declare class WidgetTilesetSourceImpl extends WidgetSource<WidgetTilesetSourcePr
|
|
|
1615
1613
|
getFeatures(): Promise<FeaturesResponse>;
|
|
1616
1614
|
getFormula({ column, operation, joinOperation, filters, filterOwner, spatialFilter, }: FormulaRequestOptions): Promise<FormulaResponse>;
|
|
1617
1615
|
getHistogram({ operation, ticks, column, joinOperation, filters, filterOwner, spatialFilter, }: HistogramRequestOptions): Promise<HistogramResponse>;
|
|
1618
|
-
getCategories({ column, operation, operationColumn, joinOperation, filters, filterOwner, spatialFilter,
|
|
1616
|
+
getCategories({ column, operation, operationColumn, joinOperation, filters, filterOwner, spatialFilter, }: CategoryRequestOptions): Promise<CategoryResponse>;
|
|
1619
1617
|
getScatter({ xAxisColumn, yAxisColumn, xAxisJoinOperation, yAxisJoinOperation, filters, filterOwner, spatialFilter, }: ScatterRequestOptions): Promise<ScatterResponse>;
|
|
1620
1618
|
getTable({ columns, searchFilterColumn, searchFilterText, sortBy, sortDirection, sortByColumnType, offset, limit, filters, filterOwner, spatialFilter, }: TableRequestOptions): Promise<TableResponse>;
|
|
1621
1619
|
getTimeSeries({ column, stepSize, operation, operationColumn, joinOperation, filters, filterOwner, spatialFilter, }: TimeSeriesRequestOptions): Promise<TimeSeriesResponse>;
|
|
@@ -1736,13 +1734,6 @@ declare class WidgetTableSource extends WidgetRemoteSource<LayerTableSourceOptio
|
|
|
1736
1734
|
protected getModelSource(filters: Filters | undefined, filterOwner?: string): ModelSource;
|
|
1737
1735
|
}
|
|
1738
1736
|
|
|
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
|
-
|
|
1746
1737
|
type H3QuerySourceOptions = SourceOptions & QuerySourceOptions & AggregationOptions & FilterOptions;
|
|
1747
1738
|
type H3QuerySourceResponse = TilejsonResult & WidgetQuerySourceResult;
|
|
1748
1739
|
declare const h3QuerySource: (options: H3QuerySourceOptions) => Promise<H3QuerySourceResponse>;
|
|
@@ -1826,13 +1817,12 @@ type GroupByFeature = {
|
|
|
1826
1817
|
value: number;
|
|
1827
1818
|
}[];
|
|
1828
1819
|
/** @privateRemarks Source: @carto/react-core */
|
|
1829
|
-
declare function groupValuesByColumn({ data, valuesColumns, joinOperation, keysColumn, operation,
|
|
1820
|
+
declare function groupValuesByColumn({ data, valuesColumns, joinOperation, keysColumn, operation, }: {
|
|
1830
1821
|
data: FeatureData[];
|
|
1831
1822
|
valuesColumns?: string[];
|
|
1832
1823
|
joinOperation?: AggregationType;
|
|
1833
1824
|
keysColumn: string;
|
|
1834
1825
|
operation: AggregationType;
|
|
1835
|
-
othersThreshold?: number;
|
|
1836
1826
|
}): GroupByFeature | null;
|
|
1837
1827
|
|
|
1838
1828
|
/** @privateRemarks Source: @carto/react-core */
|
|
@@ -1881,6 +1871,24 @@ declare function makeIntervalComplete(intervals: FilterInterval[]): FilterInterv
|
|
|
1881
1871
|
*/
|
|
1882
1872
|
declare function transformToTileCoords<T extends Geometry>(geometry: T, bbox: BBox): T;
|
|
1883
1873
|
|
|
1874
|
+
/**
|
|
1875
|
+
* Custom Set-like interface optimized for BigUint64 cell IDs. Unlike Set,
|
|
1876
|
+
* limited in most JavaScript runtimes to ~16M entries, this implementation
|
|
1877
|
+
* can support up to `n = 2^32 - 1` (4 billion) entries, with lookups in
|
|
1878
|
+
* amortized O(1) time.
|
|
1879
|
+
*/
|
|
1880
|
+
declare class CellSet {
|
|
1881
|
+
/** List of cells stored by the set. Stored by reference, without copying. */
|
|
1882
|
+
private cells;
|
|
1883
|
+
/** DataView representing a single cell ID. Pre-allocated to reduce memory during queries. */
|
|
1884
|
+
private cellView;
|
|
1885
|
+
/** Hash table, mapping a hash index (computed) to an index in the 'cells' array. */
|
|
1886
|
+
private hashTable;
|
|
1887
|
+
constructor(cells: bigint[]);
|
|
1888
|
+
has(cell: bigint): boolean;
|
|
1889
|
+
private hashLookup;
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1884
1892
|
type FetchDatasetOptions = {
|
|
1885
1893
|
accessToken: string;
|
|
1886
1894
|
apiBaseUrl: string;
|
|
@@ -1913,4 +1921,4 @@ declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined
|
|
|
1913
1921
|
*/
|
|
1914
1922
|
declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
|
|
1915
1923
|
|
|
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,
|
|
1924
|
+
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, CellSet, 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 };
|
package/build/api-client.js
CHANGED
|
@@ -5438,6 +5438,64 @@ import {
|
|
|
5438
5438
|
geometryToCells as geometryToCells2,
|
|
5439
5439
|
getResolution as getResolution2
|
|
5440
5440
|
} from "quadbin";
|
|
5441
|
+
|
|
5442
|
+
// src/utils/CellSet.ts
|
|
5443
|
+
var EMPTY_U32 = 2 ** 32 - 1;
|
|
5444
|
+
var CellSet = class {
|
|
5445
|
+
constructor(cells) {
|
|
5446
|
+
/** List of cells stored by the set. Stored by reference, without copying. */
|
|
5447
|
+
__publicField(this, "cells");
|
|
5448
|
+
/** DataView representing a single cell ID. Pre-allocated to reduce memory during queries. */
|
|
5449
|
+
__publicField(this, "cellView", new DataView(new ArrayBuffer(8)));
|
|
5450
|
+
/** Hash table, mapping a hash index (computed) to an index in the 'cells' array. */
|
|
5451
|
+
__publicField(this, "hashTable");
|
|
5452
|
+
this.cells = cells;
|
|
5453
|
+
this.hashTable = new Uint32Array(hashBuckets(cells.length)).fill(EMPTY_U32);
|
|
5454
|
+
for (let cellIndex = 0; cellIndex < cells.length; cellIndex++) {
|
|
5455
|
+
this.hashTable[this.hashLookup(cells[cellIndex])] = cellIndex;
|
|
5456
|
+
}
|
|
5457
|
+
}
|
|
5458
|
+
has(cell) {
|
|
5459
|
+
const hashIndex = this.hashLookup(cell);
|
|
5460
|
+
return this.hashTable[hashIndex] !== EMPTY_U32;
|
|
5461
|
+
}
|
|
5462
|
+
hashLookup(cell) {
|
|
5463
|
+
this.cellView.setBigUint64(0, cell);
|
|
5464
|
+
const hashval = hash(this.cellView);
|
|
5465
|
+
const hashmod = this.hashTable.length - 1;
|
|
5466
|
+
let bucket = hashval & hashmod;
|
|
5467
|
+
for (let probe = 0; probe <= hashmod; probe++) {
|
|
5468
|
+
const cellIndex = this.hashTable[bucket];
|
|
5469
|
+
if (cellIndex === EMPTY_U32 || cell === this.cells[cellIndex]) {
|
|
5470
|
+
return bucket;
|
|
5471
|
+
}
|
|
5472
|
+
bucket = bucket + probe + 1 & hashmod;
|
|
5473
|
+
}
|
|
5474
|
+
throw new Error("Hash table full.");
|
|
5475
|
+
}
|
|
5476
|
+
};
|
|
5477
|
+
function hash(view, h = 0) {
|
|
5478
|
+
const m = 1540483477;
|
|
5479
|
+
const r = 24;
|
|
5480
|
+
for (let i = 0, il = view.byteLength / 4; i < il; i++) {
|
|
5481
|
+
let k = view.getUint32(i * 4);
|
|
5482
|
+
k = Math.imul(k, m) >>> 0;
|
|
5483
|
+
k = (k ^ k >> r) >>> 0;
|
|
5484
|
+
k = Math.imul(k, m) >>> 0;
|
|
5485
|
+
h = Math.imul(h, m) >>> 0;
|
|
5486
|
+
h = (h ^ k) >>> 0;
|
|
5487
|
+
}
|
|
5488
|
+
return h;
|
|
5489
|
+
}
|
|
5490
|
+
function hashBuckets(initialCount) {
|
|
5491
|
+
let buckets = 1;
|
|
5492
|
+
while (buckets < initialCount + initialCount / 4) {
|
|
5493
|
+
buckets *= 2;
|
|
5494
|
+
}
|
|
5495
|
+
return buckets;
|
|
5496
|
+
}
|
|
5497
|
+
|
|
5498
|
+
// src/filters/tileFeaturesRaster.ts
|
|
5441
5499
|
function tileFeaturesRaster({
|
|
5442
5500
|
tiles,
|
|
5443
5501
|
...options
|
|
@@ -5451,7 +5509,7 @@ function tileFeaturesRaster({
|
|
|
5451
5509
|
const tileResolution = getResolution2(tiles[0].index.q);
|
|
5452
5510
|
const tileBlockSize = tiles[0].data.blockSize;
|
|
5453
5511
|
const cellResolution = tileResolution + BigInt(Math.log2(tileBlockSize));
|
|
5454
|
-
const spatialFilterCells = new
|
|
5512
|
+
const spatialFilterCells = new CellSet(
|
|
5455
5513
|
geometryToCells2(options.spatialFilter, cellResolution)
|
|
5456
5514
|
);
|
|
5457
5515
|
const data = /* @__PURE__ */ new Map();
|
|
@@ -6271,7 +6329,7 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
6271
6329
|
spatialFiltersMode,
|
|
6272
6330
|
...params
|
|
6273
6331
|
} = options;
|
|
6274
|
-
const { column, operation: operation2, operationColumn, operationExp
|
|
6332
|
+
const { column, operation: operation2, operationColumn, operationExp } = params;
|
|
6275
6333
|
if (operation2 === AggregationTypes.Custom) {
|
|
6276
6334
|
assert2(operationExp, "operationExp is required for custom operation");
|
|
6277
6335
|
}
|
|
@@ -6286,8 +6344,7 @@ var WidgetRemoteSource = class extends WidgetSource {
|
|
|
6286
6344
|
column,
|
|
6287
6345
|
operation: operation2,
|
|
6288
6346
|
operationExp,
|
|
6289
|
-
operationColumn: operationColumn || column
|
|
6290
|
-
othersThreshold
|
|
6347
|
+
operationColumn: operationColumn || column
|
|
6291
6348
|
},
|
|
6292
6349
|
opts: { signal, headers: this.props.headers }
|
|
6293
6350
|
}).then((res) => normalizeObjectKeys(res.rows));
|
|
@@ -6677,17 +6734,13 @@ function normalizeSortByOptions({
|
|
|
6677
6734
|
});
|
|
6678
6735
|
}
|
|
6679
6736
|
|
|
6680
|
-
// src/widget-sources/constants.ts
|
|
6681
|
-
var OTHERS_CATEGORY_NAME = "_carto_others";
|
|
6682
|
-
|
|
6683
6737
|
// src/operations/groupBy.ts
|
|
6684
6738
|
function groupValuesByColumn({
|
|
6685
6739
|
data,
|
|
6686
6740
|
valuesColumns,
|
|
6687
6741
|
joinOperation,
|
|
6688
6742
|
keysColumn,
|
|
6689
|
-
operation: operation2
|
|
6690
|
-
othersThreshold
|
|
6743
|
+
operation: operation2
|
|
6691
6744
|
}) {
|
|
6692
6745
|
if (Array.isArray(data) && data.length === 0) {
|
|
6693
6746
|
return null;
|
|
@@ -6705,23 +6758,13 @@ function groupValuesByColumn({
|
|
|
6705
6758
|
return accumulator;
|
|
6706
6759
|
}, /* @__PURE__ */ new Map());
|
|
6707
6760
|
const targetOperation = aggregationFunctions[operation2];
|
|
6708
|
-
if (
|
|
6709
|
-
return []
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
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
|
-
});
|
|
6761
|
+
if (targetOperation) {
|
|
6762
|
+
return Array.from(groups).map(([name, value]) => ({
|
|
6763
|
+
name,
|
|
6764
|
+
value: targetOperation(value)
|
|
6765
|
+
}));
|
|
6723
6766
|
}
|
|
6724
|
-
return
|
|
6767
|
+
return [];
|
|
6725
6768
|
}
|
|
6726
6769
|
|
|
6727
6770
|
// src/utils/dateUtils.ts
|
|
@@ -7284,8 +7327,7 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
|
|
|
7284
7327
|
joinOperation,
|
|
7285
7328
|
filters,
|
|
7286
7329
|
filterOwner,
|
|
7287
|
-
spatialFilter
|
|
7288
|
-
othersThreshold
|
|
7330
|
+
spatialFilter
|
|
7289
7331
|
}) {
|
|
7290
7332
|
const filteredFeatures = this._getFilteredFeatures(
|
|
7291
7333
|
spatialFilter,
|
|
@@ -7301,8 +7343,7 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
|
|
|
7301
7343
|
valuesColumns: normalizeColumns(operationColumn || column),
|
|
7302
7344
|
joinOperation,
|
|
7303
7345
|
keysColumn: column,
|
|
7304
|
-
operation: operation2
|
|
7305
|
-
othersThreshold
|
|
7346
|
+
operation: operation2
|
|
7306
7347
|
});
|
|
7307
7348
|
return groups || [];
|
|
7308
7349
|
}
|
|
@@ -9985,11 +10026,11 @@ export {
|
|
|
9985
10026
|
ApiVersion,
|
|
9986
10027
|
basemap_styles_default as BASEMAP,
|
|
9987
10028
|
CartoAPIError,
|
|
10029
|
+
CellSet,
|
|
9988
10030
|
DEFAULT_API_BASE_URL,
|
|
9989
10031
|
FEATURE_GEOM_PROPERTY,
|
|
9990
10032
|
FilterType,
|
|
9991
10033
|
OPACITY_MAP,
|
|
9992
|
-
OTHERS_CATEGORY_NAME,
|
|
9993
10034
|
Provider,
|
|
9994
10035
|
SOURCE_DEFAULTS,
|
|
9995
10036
|
SchemaFieldType,
|