@carto/api-client 0.5.1-alpha.2 → 0.5.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -2
- package/build/api-client.cjs +101 -106
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +46 -15
- package/build/api-client.d.ts +46 -15
- package/build/api-client.js +95 -105
- package/build/api-client.js.map +1 -1
- package/build/worker.js +38 -33
- package/build/worker.js.map +1 -1
- package/package.json +3 -3
- package/src/fetch-map/fetch-map.ts +1 -7
- package/src/fetch-map/parse-map.ts +2 -1
- package/src/fetch-map/source.ts +12 -3
- package/src/fetch-map/types.ts +3 -2
- package/src/filters.ts +37 -2
- package/src/index.ts +1 -0
- package/src/sources/base-source.ts +8 -22
- package/src/sources/boundary-query-source.ts +1 -5
- package/src/sources/boundary-table-source.ts +1 -5
- package/src/sources/h3-query-source.ts +1 -1
- package/src/sources/h3-table-source.ts +1 -1
- package/src/sources/h3-tileset-source.ts +2 -2
- package/src/sources/index.ts +18 -10
- package/src/sources/quadbin-query-source.ts +1 -1
- package/src/sources/quadbin-table-source.ts +1 -1
- package/src/sources/quadbin-tileset-source.ts +2 -2
- package/src/sources/raster-source.ts +3 -3
- package/src/sources/types.ts +6 -8
- package/src/sources/vector-query-source.ts +1 -1
- package/src/sources/vector-table-source.ts +1 -1
- package/src/sources/vector-tileset-source.ts +2 -2
- package/src/types-internal.ts +0 -24
- package/src/utils.ts +0 -35
- package/src/widget-sources/types.ts +2 -2
- package/src/widget-sources/widget-remote-source.ts +2 -1
- package/src/widget-sources/widget-tileset-source-impl.ts +6 -6
package/build/api-client.d.cts
CHANGED
|
@@ -219,10 +219,6 @@ type PositionalQueryParameter = QueryParameterValue[];
|
|
|
219
219
|
/** @privateRemarks Source: @deck.gl/carto */
|
|
220
220
|
type QueryParameters = NamedQueryParameter | PositionalQueryParameter;
|
|
221
221
|
|
|
222
|
-
/******************************************************************************
|
|
223
|
-
* COMMON
|
|
224
|
-
*/
|
|
225
|
-
|
|
226
222
|
/******************************************************************************
|
|
227
223
|
* LOCAL CALCULATIONS
|
|
228
224
|
*/
|
|
@@ -323,8 +319,6 @@ type SourceOptionalOptions = {
|
|
|
323
319
|
value?: number;
|
|
324
320
|
};
|
|
325
321
|
clientId: string;
|
|
326
|
-
/** @deprecated use `query` instead **/
|
|
327
|
-
format: Format;
|
|
328
322
|
/**
|
|
329
323
|
* Maximum URL character length. Above this limit, requests use POST.
|
|
330
324
|
* Used to avoid browser and CDN limits.
|
|
@@ -637,11 +631,6 @@ type RasterMetadata = {
|
|
|
637
631
|
type TilejsonResult = Tilejson & {
|
|
638
632
|
accessToken: string;
|
|
639
633
|
};
|
|
640
|
-
type GeojsonResult = {
|
|
641
|
-
type: 'FeatureCollection';
|
|
642
|
-
features: Feature[];
|
|
643
|
-
};
|
|
644
|
-
type JsonResult = any[];
|
|
645
634
|
type QueryResult = {
|
|
646
635
|
meta: {
|
|
647
636
|
cacheHit: boolean;
|
|
@@ -786,6 +775,7 @@ type KeplerMapConfig = {
|
|
|
786
775
|
styleType: string;
|
|
787
776
|
visibleLayerGroups: Record<string, boolean>;
|
|
788
777
|
};
|
|
778
|
+
legendSettings?: any;
|
|
789
779
|
popupSettings: any;
|
|
790
780
|
visState: {
|
|
791
781
|
layers: MapConfigLayer[];
|
|
@@ -864,7 +854,7 @@ type Dataset = {
|
|
|
864
854
|
cache?: number;
|
|
865
855
|
connectionName: string;
|
|
866
856
|
geoColumn: string;
|
|
867
|
-
data: TilejsonResult
|
|
857
|
+
data: TilejsonResult;
|
|
868
858
|
columns: string[];
|
|
869
859
|
format: Format;
|
|
870
860
|
aggregationExp: string;
|
|
@@ -926,6 +916,7 @@ declare function parseMap(json: any): {
|
|
|
926
916
|
visibleLayerGroups: Record<string, boolean>;
|
|
927
917
|
};
|
|
928
918
|
popupSettings: any;
|
|
919
|
+
legendSettings: any;
|
|
929
920
|
token: any;
|
|
930
921
|
layers: (LayerDescriptor | undefined)[];
|
|
931
922
|
};
|
|
@@ -1028,6 +1019,14 @@ type GetFilterOptions<T extends FilterType> = {
|
|
|
1028
1019
|
owner?: string;
|
|
1029
1020
|
};
|
|
1030
1021
|
declare function getFilter<T extends FilterType>(filters: Record<string, Filter>, { column, type, owner }: GetFilterOptions<T>): Filter[T] | null;
|
|
1022
|
+
/**
|
|
1023
|
+
* Given all filters for a dataset, returns the subset of filters that are not
|
|
1024
|
+
* attributable to the given owner. Typically used to allow filterable widgets
|
|
1025
|
+
* to affect other widgets *without* filtering themselves.
|
|
1026
|
+
*
|
|
1027
|
+
* @privateRemarks Source: @carto/react-widgets
|
|
1028
|
+
*/
|
|
1029
|
+
declare function getApplicableFilters(owner?: string, filters?: Record<string, Filter>): Record<string, Filter>;
|
|
1031
1030
|
|
|
1032
1031
|
/**
|
|
1033
1032
|
* Returns a {@link SpatialFilter} for a given viewport, typically obtained
|
|
@@ -1162,9 +1161,9 @@ interface TableRequestOptions extends BaseRequestOptions {
|
|
|
1162
1161
|
sortByColumnType?: SortColumnType;
|
|
1163
1162
|
offset?: number;
|
|
1164
1163
|
limit?: number;
|
|
1165
|
-
/**
|
|
1164
|
+
/** @deprecated Supported for tilesets only. Prefer `filters` (for all sources) instead. */
|
|
1166
1165
|
searchFilterColumn?: string;
|
|
1167
|
-
/**
|
|
1166
|
+
/** @deprecated Supported for tilesets only. Prefer `filters` (for all sources) instead. */
|
|
1168
1167
|
searchFilterText?: string;
|
|
1169
1168
|
}
|
|
1170
1169
|
/** Options for {@link WidgetRemoteSource#getTimeSeries}. */
|
|
@@ -1737,4 +1736,36 @@ declare function makeIntervalComplete(intervals: FilterInterval[]): FilterInterv
|
|
|
1737
1736
|
*/
|
|
1738
1737
|
declare function transformToTileCoords<T extends Geometry>(geometry: T, bbox: BBox): T;
|
|
1739
1738
|
|
|
1740
|
-
|
|
1739
|
+
type FetchDatasetOptions = {
|
|
1740
|
+
accessToken: string;
|
|
1741
|
+
apiBaseUrl: string;
|
|
1742
|
+
connection: string;
|
|
1743
|
+
headers?: Record<string, string>;
|
|
1744
|
+
localCache?: {
|
|
1745
|
+
cacheControl: 'no-cache'[];
|
|
1746
|
+
};
|
|
1747
|
+
maxLengthURL?: number;
|
|
1748
|
+
};
|
|
1749
|
+
type FetchDataset = {
|
|
1750
|
+
dataset: Dataset;
|
|
1751
|
+
filters?: Filter;
|
|
1752
|
+
options: FetchDatasetOptions;
|
|
1753
|
+
};
|
|
1754
|
+
declare function configureSource({ dataset, filters, options, }: FetchDataset): Promise<TilejsonResult>;
|
|
1755
|
+
/**
|
|
1756
|
+
* @internal
|
|
1757
|
+
* State of `aggregationResLevel` in the UI and backend config is based on an assumption of
|
|
1758
|
+
* 512x512px tiles. Because we may change tile resolution for performance goals, the
|
|
1759
|
+
* `aggregationResLevel` passed to the deck.gl layer must be scaled with tile resolution.
|
|
1760
|
+
*/
|
|
1761
|
+
declare function scaleAggregationResLevel(aggregationResLevel: number, tileResolution: number): number | undefined;
|
|
1762
|
+
/**
|
|
1763
|
+
* @internal
|
|
1764
|
+
*/
|
|
1765
|
+
declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined): string | null | undefined;
|
|
1766
|
+
/**
|
|
1767
|
+
* @internal
|
|
1768
|
+
*/
|
|
1769
|
+
declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
|
|
1770
|
+
|
|
1771
|
+
export { AGGREGATION, type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryRequestOptions, type CategoryResponse, type ColumnsOption, DEFAULT_API_BASE_URL, FEATURE_GEOM_PROPERTY, type FeaturesRequestOptions, type FeaturesResponse, type FetchMapOptions, type FetchMapResult, type Filter, type FilterFunction, type FilterInterval, type FilterIntervalComplete, type FilterIntervalExtremum, type FilterLogicalOperator, type FilterOptions, FilterType, type Filters, type Format, type FormulaRequestOptions, type FormulaResponse, type GetFilterOptions, type GoogleBasemap, type GroupByFeature, type GroupDateType, type H3QuerySourceOptions, type H3QuerySourceResponse, type H3TableSourceOptions, type H3TableSourceResponse, type H3TilesetSourceOptions, type H3TilesetSourceResponse, type HasFilterOptions, type HistogramRequestOptions, type HistogramResponse, type KeplerMapConfig, type Layer, type LayerDescriptor, type LayerType, type MapLibreBasemap, type MapType, type NamedQueryParameter, OPACITY_MAP, type ParseMapResult, type PositionalQueryParameter, Provider, type ProviderType, type QuadbinQuerySourceOptions, type QuadbinQuerySourceResponse, type QuadbinTableSourceOptions, type QuadbinTableSourceResponse, type QuadbinTilesetSourceOptions, type QuadbinTilesetSourceResponse, type QueryOptions, type QueryParameterValue, type QueryParameters, type QueryResult, type QuerySourceOptions, type RangeRequestOptions, type RangeResponse, type Raster, RasterBandColorinterp, type RasterBandType, type RasterMetadata, type RasterMetadataBand, type RasterMetadataBandStats, type RasterSourceOptions, type RasterTile, type RemoveFilterOptions, type SCALE_TYPE, SOURCE_DEFAULTS, type ScatterPlotFeature, type ScatterRequestOptions, type ScatterResponse, type SortColumnType, type SortDirection, type SourceOptionalOptions, type SourceOptions, type SourceRequiredOptions, type SpatialDataType, type SpatialFilter, type SpatialFilterPolyfillMode, SpatialIndex, SpatialIndexColumn, type SpatialIndexTile, type StringSearchOptions, type TableRequestOptions, type TableResponse, type TableSourceOptions, type Tile, type TileFeatureExtractOptions, type TileFeatures, type TileFeaturesSpatialIndexOptions, TileFormat, type TileResolution, type Tilejson, type TilejsonResult, type TilesetSourceOptions, type Tilestats, type TimeSeriesRequestOptions, type TimeSeriesResponse, type VectorLayer, type VectorQuerySourceOptions, type VectorQuerySourceResponse, type VectorTableSourceOptions, type VectorTableSourceResponse, type VectorTilesetSourceOptions, type VectorTilesetSourceResponse, type ViewState, type Viewport, WidgetQuerySource, type WidgetQuerySourceResult, WidgetRasterSource, type WidgetRasterSourceProps, type WidgetRasterSourceResult, WidgetRemoteSource, type WidgetRemoteSourceProps, WidgetSource, type WidgetSourceProps, WidgetTableSource, type WidgetTableSourceResult, WidgetTilesetSource, type WidgetTilesetSourceProps, type WidgetTilesetSourceResult, type _DataFilterExtensionProps, _buildFeatureFilter, domainFromValues as _domainFromValues, _getHexagonResolution, addFilter, aggregate, aggregationFunctions, applyFilters, applySorting, boundaryQuerySource, boundaryTableSource, buildBinaryFeatureFilter, buildPublicMapUrl, buildStatsUrl, clearFilters, configureSource, createPolygonSpatialFilter, createViewportSpatialFilter, fetchBasemapProps, fetchMap, filterFunctions, geojsonFeatures, getApplicableFilters, getClient, getColorAccessor, getColorValueAccessor, getColumnNameFromGeoColumn, getDataFilterExtensionProps, getFilter, getIconUrlAccessor, getLayerProps, getMaxMarkerSize, getSizeAccessor, getSpatialIndexFromGeoColumn, getTextAccessor, groupValuesByColumn, groupValuesByDateColumn, h3QuerySource, h3TableSource, h3TilesetSource, hasFilter, histogram, makeIntervalComplete, negateAccessor, opacityToAlpha, parseMap, quadbinQuerySource, quadbinTableSource, quadbinTilesetSource, query, rasterSource, removeFilter, requestWithParameters, scaleAggregationResLevel, scatterPlot, setClient, tileFeatures, tileFeaturesGeometries, tileFeaturesSpatialIndex, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
|
package/build/api-client.d.ts
CHANGED
|
@@ -219,10 +219,6 @@ type PositionalQueryParameter = QueryParameterValue[];
|
|
|
219
219
|
/** @privateRemarks Source: @deck.gl/carto */
|
|
220
220
|
type QueryParameters = NamedQueryParameter | PositionalQueryParameter;
|
|
221
221
|
|
|
222
|
-
/******************************************************************************
|
|
223
|
-
* COMMON
|
|
224
|
-
*/
|
|
225
|
-
|
|
226
222
|
/******************************************************************************
|
|
227
223
|
* LOCAL CALCULATIONS
|
|
228
224
|
*/
|
|
@@ -323,8 +319,6 @@ type SourceOptionalOptions = {
|
|
|
323
319
|
value?: number;
|
|
324
320
|
};
|
|
325
321
|
clientId: string;
|
|
326
|
-
/** @deprecated use `query` instead **/
|
|
327
|
-
format: Format;
|
|
328
322
|
/**
|
|
329
323
|
* Maximum URL character length. Above this limit, requests use POST.
|
|
330
324
|
* Used to avoid browser and CDN limits.
|
|
@@ -637,11 +631,6 @@ type RasterMetadata = {
|
|
|
637
631
|
type TilejsonResult = Tilejson & {
|
|
638
632
|
accessToken: string;
|
|
639
633
|
};
|
|
640
|
-
type GeojsonResult = {
|
|
641
|
-
type: 'FeatureCollection';
|
|
642
|
-
features: Feature[];
|
|
643
|
-
};
|
|
644
|
-
type JsonResult = any[];
|
|
645
634
|
type QueryResult = {
|
|
646
635
|
meta: {
|
|
647
636
|
cacheHit: boolean;
|
|
@@ -786,6 +775,7 @@ type KeplerMapConfig = {
|
|
|
786
775
|
styleType: string;
|
|
787
776
|
visibleLayerGroups: Record<string, boolean>;
|
|
788
777
|
};
|
|
778
|
+
legendSettings?: any;
|
|
789
779
|
popupSettings: any;
|
|
790
780
|
visState: {
|
|
791
781
|
layers: MapConfigLayer[];
|
|
@@ -864,7 +854,7 @@ type Dataset = {
|
|
|
864
854
|
cache?: number;
|
|
865
855
|
connectionName: string;
|
|
866
856
|
geoColumn: string;
|
|
867
|
-
data: TilejsonResult
|
|
857
|
+
data: TilejsonResult;
|
|
868
858
|
columns: string[];
|
|
869
859
|
format: Format;
|
|
870
860
|
aggregationExp: string;
|
|
@@ -926,6 +916,7 @@ declare function parseMap(json: any): {
|
|
|
926
916
|
visibleLayerGroups: Record<string, boolean>;
|
|
927
917
|
};
|
|
928
918
|
popupSettings: any;
|
|
919
|
+
legendSettings: any;
|
|
929
920
|
token: any;
|
|
930
921
|
layers: (LayerDescriptor | undefined)[];
|
|
931
922
|
};
|
|
@@ -1028,6 +1019,14 @@ type GetFilterOptions<T extends FilterType> = {
|
|
|
1028
1019
|
owner?: string;
|
|
1029
1020
|
};
|
|
1030
1021
|
declare function getFilter<T extends FilterType>(filters: Record<string, Filter>, { column, type, owner }: GetFilterOptions<T>): Filter[T] | null;
|
|
1022
|
+
/**
|
|
1023
|
+
* Given all filters for a dataset, returns the subset of filters that are not
|
|
1024
|
+
* attributable to the given owner. Typically used to allow filterable widgets
|
|
1025
|
+
* to affect other widgets *without* filtering themselves.
|
|
1026
|
+
*
|
|
1027
|
+
* @privateRemarks Source: @carto/react-widgets
|
|
1028
|
+
*/
|
|
1029
|
+
declare function getApplicableFilters(owner?: string, filters?: Record<string, Filter>): Record<string, Filter>;
|
|
1031
1030
|
|
|
1032
1031
|
/**
|
|
1033
1032
|
* Returns a {@link SpatialFilter} for a given viewport, typically obtained
|
|
@@ -1162,9 +1161,9 @@ interface TableRequestOptions extends BaseRequestOptions {
|
|
|
1162
1161
|
sortByColumnType?: SortColumnType;
|
|
1163
1162
|
offset?: number;
|
|
1164
1163
|
limit?: number;
|
|
1165
|
-
/**
|
|
1164
|
+
/** @deprecated Supported for tilesets only. Prefer `filters` (for all sources) instead. */
|
|
1166
1165
|
searchFilterColumn?: string;
|
|
1167
|
-
/**
|
|
1166
|
+
/** @deprecated Supported for tilesets only. Prefer `filters` (for all sources) instead. */
|
|
1168
1167
|
searchFilterText?: string;
|
|
1169
1168
|
}
|
|
1170
1169
|
/** Options for {@link WidgetRemoteSource#getTimeSeries}. */
|
|
@@ -1737,4 +1736,36 @@ declare function makeIntervalComplete(intervals: FilterInterval[]): FilterInterv
|
|
|
1737
1736
|
*/
|
|
1738
1737
|
declare function transformToTileCoords<T extends Geometry>(geometry: T, bbox: BBox): T;
|
|
1739
1738
|
|
|
1740
|
-
|
|
1739
|
+
type FetchDatasetOptions = {
|
|
1740
|
+
accessToken: string;
|
|
1741
|
+
apiBaseUrl: string;
|
|
1742
|
+
connection: string;
|
|
1743
|
+
headers?: Record<string, string>;
|
|
1744
|
+
localCache?: {
|
|
1745
|
+
cacheControl: 'no-cache'[];
|
|
1746
|
+
};
|
|
1747
|
+
maxLengthURL?: number;
|
|
1748
|
+
};
|
|
1749
|
+
type FetchDataset = {
|
|
1750
|
+
dataset: Dataset;
|
|
1751
|
+
filters?: Filter;
|
|
1752
|
+
options: FetchDatasetOptions;
|
|
1753
|
+
};
|
|
1754
|
+
declare function configureSource({ dataset, filters, options, }: FetchDataset): Promise<TilejsonResult>;
|
|
1755
|
+
/**
|
|
1756
|
+
* @internal
|
|
1757
|
+
* State of `aggregationResLevel` in the UI and backend config is based on an assumption of
|
|
1758
|
+
* 512x512px tiles. Because we may change tile resolution for performance goals, the
|
|
1759
|
+
* `aggregationResLevel` passed to the deck.gl layer must be scaled with tile resolution.
|
|
1760
|
+
*/
|
|
1761
|
+
declare function scaleAggregationResLevel(aggregationResLevel: number, tileResolution: number): number | undefined;
|
|
1762
|
+
/**
|
|
1763
|
+
* @internal
|
|
1764
|
+
*/
|
|
1765
|
+
declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined): string | null | undefined;
|
|
1766
|
+
/**
|
|
1767
|
+
* @internal
|
|
1768
|
+
*/
|
|
1769
|
+
declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
|
|
1770
|
+
|
|
1771
|
+
export { AGGREGATION, type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryRequestOptions, type CategoryResponse, type ColumnsOption, DEFAULT_API_BASE_URL, FEATURE_GEOM_PROPERTY, type FeaturesRequestOptions, type FeaturesResponse, type FetchMapOptions, type FetchMapResult, type Filter, type FilterFunction, type FilterInterval, type FilterIntervalComplete, type FilterIntervalExtremum, type FilterLogicalOperator, type FilterOptions, FilterType, type Filters, type Format, type FormulaRequestOptions, type FormulaResponse, type GetFilterOptions, type GoogleBasemap, type GroupByFeature, type GroupDateType, type H3QuerySourceOptions, type H3QuerySourceResponse, type H3TableSourceOptions, type H3TableSourceResponse, type H3TilesetSourceOptions, type H3TilesetSourceResponse, type HasFilterOptions, type HistogramRequestOptions, type HistogramResponse, type KeplerMapConfig, type Layer, type LayerDescriptor, type LayerType, type MapLibreBasemap, type MapType, type NamedQueryParameter, OPACITY_MAP, type ParseMapResult, type PositionalQueryParameter, Provider, type ProviderType, type QuadbinQuerySourceOptions, type QuadbinQuerySourceResponse, type QuadbinTableSourceOptions, type QuadbinTableSourceResponse, type QuadbinTilesetSourceOptions, type QuadbinTilesetSourceResponse, type QueryOptions, type QueryParameterValue, type QueryParameters, type QueryResult, type QuerySourceOptions, type RangeRequestOptions, type RangeResponse, type Raster, RasterBandColorinterp, type RasterBandType, type RasterMetadata, type RasterMetadataBand, type RasterMetadataBandStats, type RasterSourceOptions, type RasterTile, type RemoveFilterOptions, type SCALE_TYPE, SOURCE_DEFAULTS, type ScatterPlotFeature, type ScatterRequestOptions, type ScatterResponse, type SortColumnType, type SortDirection, type SourceOptionalOptions, type SourceOptions, type SourceRequiredOptions, type SpatialDataType, type SpatialFilter, type SpatialFilterPolyfillMode, SpatialIndex, SpatialIndexColumn, type SpatialIndexTile, type StringSearchOptions, type TableRequestOptions, type TableResponse, type TableSourceOptions, type Tile, type TileFeatureExtractOptions, type TileFeatures, type TileFeaturesSpatialIndexOptions, TileFormat, type TileResolution, type Tilejson, type TilejsonResult, type TilesetSourceOptions, type Tilestats, type TimeSeriesRequestOptions, type TimeSeriesResponse, type VectorLayer, type VectorQuerySourceOptions, type VectorQuerySourceResponse, type VectorTableSourceOptions, type VectorTableSourceResponse, type VectorTilesetSourceOptions, type VectorTilesetSourceResponse, type ViewState, type Viewport, WidgetQuerySource, type WidgetQuerySourceResult, WidgetRasterSource, type WidgetRasterSourceProps, type WidgetRasterSourceResult, WidgetRemoteSource, type WidgetRemoteSourceProps, WidgetSource, type WidgetSourceProps, WidgetTableSource, type WidgetTableSourceResult, WidgetTilesetSource, type WidgetTilesetSourceProps, type WidgetTilesetSourceResult, type _DataFilterExtensionProps, _buildFeatureFilter, domainFromValues as _domainFromValues, _getHexagonResolution, addFilter, aggregate, aggregationFunctions, applyFilters, applySorting, boundaryQuerySource, boundaryTableSource, buildBinaryFeatureFilter, buildPublicMapUrl, buildStatsUrl, clearFilters, configureSource, createPolygonSpatialFilter, createViewportSpatialFilter, fetchBasemapProps, fetchMap, filterFunctions, geojsonFeatures, getApplicableFilters, getClient, getColorAccessor, getColorValueAccessor, getColumnNameFromGeoColumn, getDataFilterExtensionProps, getFilter, getIconUrlAccessor, getLayerProps, getMaxMarkerSize, getSizeAccessor, getSpatialIndexFromGeoColumn, getTextAccessor, groupValuesByColumn, groupValuesByDateColumn, h3QuerySource, h3TableSource, h3TilesetSource, hasFilter, histogram, makeIntervalComplete, negateAccessor, opacityToAlpha, parseMap, quadbinQuerySource, quadbinTableSource, quadbinTilesetSource, query, rasterSource, removeFilter, requestWithParameters, scaleAggregationResLevel, scatterPlot, setClient, tileFeatures, tileFeaturesGeometries, tileFeaturesSpatialIndex, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
|
package/build/api-client.js
CHANGED
|
@@ -10894,24 +10894,6 @@ function isValidBandValue(value, nodata) {
|
|
|
10894
10894
|
}
|
|
10895
10895
|
|
|
10896
10896
|
// src/utils.ts
|
|
10897
|
-
var FILTER_TYPES = new Set(Object.values(FilterType));
|
|
10898
|
-
var isFilterType = (type) => FILTER_TYPES.has(type);
|
|
10899
|
-
function getApplicableFilters(owner, filters) {
|
|
10900
|
-
if (!filters) return {};
|
|
10901
|
-
const applicableFilters = {};
|
|
10902
|
-
for (const column in filters) {
|
|
10903
|
-
for (const type in filters[column]) {
|
|
10904
|
-
if (!isFilterType(type)) continue;
|
|
10905
|
-
const filter = filters[column][type];
|
|
10906
|
-
const isApplicable = !owner || !filter?.owner || filter?.owner !== owner;
|
|
10907
|
-
if (filter && isApplicable) {
|
|
10908
|
-
applicableFilters[column] || (applicableFilters[column] = {});
|
|
10909
|
-
applicableFilters[column][type] = filter;
|
|
10910
|
-
}
|
|
10911
|
-
}
|
|
10912
|
-
}
|
|
10913
|
-
return applicableFilters;
|
|
10914
|
-
}
|
|
10915
10897
|
function normalizeObjectKeys(el) {
|
|
10916
10898
|
if (Array.isArray(el)) {
|
|
10917
10899
|
return el.map((value) => normalizeObjectKeys(value));
|
|
@@ -11282,7 +11264,6 @@ function excludeURLParameters(baseUrlString, parameters) {
|
|
|
11282
11264
|
// src/sources/base-source.ts
|
|
11283
11265
|
var SOURCE_DEFAULTS = {
|
|
11284
11266
|
apiBaseUrl: DEFAULT_API_BASE_URL,
|
|
11285
|
-
format: "tilejson",
|
|
11286
11267
|
headers: {},
|
|
11287
11268
|
maxLengthURL: DEFAULT_MAX_LENGTH_URL
|
|
11288
11269
|
};
|
|
@@ -11301,7 +11282,7 @@ async function baseSource(endpoint, options, urlParameters) {
|
|
|
11301
11282
|
}
|
|
11302
11283
|
}
|
|
11303
11284
|
const baseUrl = buildSourceUrl(mergedOptions);
|
|
11304
|
-
const { clientId, maxLengthURL,
|
|
11285
|
+
const { clientId, maxLengthURL, localCache } = mergedOptions;
|
|
11305
11286
|
const headers = {
|
|
11306
11287
|
Authorization: `Bearer ${options.accessToken}`,
|
|
11307
11288
|
...options.headers
|
|
@@ -11321,7 +11302,7 @@ async function baseSource(endpoint, options, urlParameters) {
|
|
|
11321
11302
|
maxLengthURL,
|
|
11322
11303
|
localCache
|
|
11323
11304
|
});
|
|
11324
|
-
const dataUrl = mapInstantiation
|
|
11305
|
+
const dataUrl = mapInstantiation.tilejson.url[0];
|
|
11325
11306
|
if (cache) {
|
|
11326
11307
|
cache.value = parseInt(
|
|
11327
11308
|
new URL(dataUrl).searchParams.get("cache") || "",
|
|
@@ -11329,21 +11310,7 @@ async function baseSource(endpoint, options, urlParameters) {
|
|
|
11329
11310
|
);
|
|
11330
11311
|
}
|
|
11331
11312
|
errorContext.requestType = "Map data";
|
|
11332
|
-
|
|
11333
|
-
const json = await requestWithParameters({
|
|
11334
|
-
baseUrl: dataUrl,
|
|
11335
|
-
parameters: { client: clientId },
|
|
11336
|
-
headers,
|
|
11337
|
-
errorContext,
|
|
11338
|
-
maxLengthURL,
|
|
11339
|
-
localCache
|
|
11340
|
-
});
|
|
11341
|
-
if (accessToken) {
|
|
11342
|
-
json.accessToken = accessToken;
|
|
11343
|
-
}
|
|
11344
|
-
return json;
|
|
11345
|
-
}
|
|
11346
|
-
return await requestWithParameters({
|
|
11313
|
+
const json = await requestWithParameters({
|
|
11347
11314
|
baseUrl: dataUrl,
|
|
11348
11315
|
parameters: { client: clientId },
|
|
11349
11316
|
headers,
|
|
@@ -11351,6 +11318,10 @@ async function baseSource(endpoint, options, urlParameters) {
|
|
|
11351
11318
|
maxLengthURL,
|
|
11352
11319
|
localCache
|
|
11353
11320
|
});
|
|
11321
|
+
if (accessToken) {
|
|
11322
|
+
json.accessToken = accessToken;
|
|
11323
|
+
}
|
|
11324
|
+
return json;
|
|
11354
11325
|
}
|
|
11355
11326
|
|
|
11356
11327
|
// src/sources/boundary-query-source.ts
|
|
@@ -11375,11 +11346,7 @@ var boundaryQuerySource = async function(options) {
|
|
|
11375
11346
|
if (queryParameters) {
|
|
11376
11347
|
urlParameters.queryParameters = queryParameters;
|
|
11377
11348
|
}
|
|
11378
|
-
return baseSource(
|
|
11379
|
-
"boundary",
|
|
11380
|
-
options,
|
|
11381
|
-
urlParameters
|
|
11382
|
-
);
|
|
11349
|
+
return baseSource("boundary", options, urlParameters);
|
|
11383
11350
|
};
|
|
11384
11351
|
|
|
11385
11352
|
// src/sources/boundary-table-source.ts
|
|
@@ -11395,11 +11362,7 @@ var boundaryTableSource = async function(options) {
|
|
|
11395
11362
|
if (filters) {
|
|
11396
11363
|
urlParameters.filters = filters;
|
|
11397
11364
|
}
|
|
11398
|
-
return baseSource(
|
|
11399
|
-
"boundary",
|
|
11400
|
-
options,
|
|
11401
|
-
urlParameters
|
|
11402
|
-
);
|
|
11365
|
+
return baseSource("boundary", options, urlParameters);
|
|
11403
11366
|
};
|
|
11404
11367
|
|
|
11405
11368
|
// src/widget-sources/widget-source.ts
|
|
@@ -11577,6 +11540,82 @@ function objectToURLSearchParams(object) {
|
|
|
11577
11540
|
return params;
|
|
11578
11541
|
}
|
|
11579
11542
|
|
|
11543
|
+
// src/filters.ts
|
|
11544
|
+
var FILTER_TYPES = new Set(Object.values(FilterType));
|
|
11545
|
+
var isFilterType = (type) => FILTER_TYPES.has(type);
|
|
11546
|
+
function addFilter(filters, { column, type, values, owner }) {
|
|
11547
|
+
if (!filters[column]) {
|
|
11548
|
+
filters[column] = {};
|
|
11549
|
+
}
|
|
11550
|
+
const filter = { values, owner };
|
|
11551
|
+
filters[column][type] = filter;
|
|
11552
|
+
return filters;
|
|
11553
|
+
}
|
|
11554
|
+
function removeFilter(filters, { column, owner }) {
|
|
11555
|
+
const filter = filters[column];
|
|
11556
|
+
if (!filter) {
|
|
11557
|
+
return filters;
|
|
11558
|
+
}
|
|
11559
|
+
if (owner) {
|
|
11560
|
+
for (const type of FILTER_TYPES) {
|
|
11561
|
+
if (owner === filter[type]?.owner) {
|
|
11562
|
+
delete filter[type];
|
|
11563
|
+
}
|
|
11564
|
+
}
|
|
11565
|
+
}
|
|
11566
|
+
if (!owner || isEmptyObject(filter)) {
|
|
11567
|
+
delete filters[column];
|
|
11568
|
+
}
|
|
11569
|
+
return filters;
|
|
11570
|
+
}
|
|
11571
|
+
function clearFilters(filters) {
|
|
11572
|
+
for (const column of Object.keys(filters)) {
|
|
11573
|
+
delete filters[column];
|
|
11574
|
+
}
|
|
11575
|
+
return filters;
|
|
11576
|
+
}
|
|
11577
|
+
function hasFilter(filters, { column, owner }) {
|
|
11578
|
+
const filter = filters[column];
|
|
11579
|
+
if (!filter) {
|
|
11580
|
+
return false;
|
|
11581
|
+
}
|
|
11582
|
+
if (!owner) {
|
|
11583
|
+
return true;
|
|
11584
|
+
}
|
|
11585
|
+
for (const type of FILTER_TYPES) {
|
|
11586
|
+
if (owner === filter[type]?.owner) {
|
|
11587
|
+
return true;
|
|
11588
|
+
}
|
|
11589
|
+
}
|
|
11590
|
+
return false;
|
|
11591
|
+
}
|
|
11592
|
+
function getFilter(filters, { column, type, owner }) {
|
|
11593
|
+
const filter = filters[column];
|
|
11594
|
+
if (!filter) {
|
|
11595
|
+
return null;
|
|
11596
|
+
}
|
|
11597
|
+
if (!owner || owner === filter[type]?.owner) {
|
|
11598
|
+
return filter[type] || null;
|
|
11599
|
+
}
|
|
11600
|
+
return null;
|
|
11601
|
+
}
|
|
11602
|
+
function getApplicableFilters(owner, filters) {
|
|
11603
|
+
if (!filters) return {};
|
|
11604
|
+
const applicableFilters = {};
|
|
11605
|
+
for (const column in filters) {
|
|
11606
|
+
for (const type in filters[column]) {
|
|
11607
|
+
if (!isFilterType(type)) continue;
|
|
11608
|
+
const filter = filters[column][type];
|
|
11609
|
+
const isApplicable = !owner || !filter?.owner || filter?.owner !== owner;
|
|
11610
|
+
if (filter && isApplicable) {
|
|
11611
|
+
applicableFilters[column] || (applicableFilters[column] = {});
|
|
11612
|
+
applicableFilters[column][type] = filter;
|
|
11613
|
+
}
|
|
11614
|
+
}
|
|
11615
|
+
}
|
|
11616
|
+
return applicableFilters;
|
|
11617
|
+
}
|
|
11618
|
+
|
|
11580
11619
|
// src/widget-sources/widget-remote-source.ts
|
|
11581
11620
|
var WidgetRemoteSource = class extends WidgetSource {
|
|
11582
11621
|
_getModelSource(filters, filterOwner) {
|
|
@@ -12648,6 +12687,9 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
|
|
|
12648
12687
|
return { rows: [], totalCount: 0 };
|
|
12649
12688
|
}
|
|
12650
12689
|
if (searchFilterColumn && searchFilterText) {
|
|
12690
|
+
console.warn(
|
|
12691
|
+
'WidgetTilesetSource: "searchFilterText" is deprecated, use "filters" and FilterType.STRING_SEARCH instead.'
|
|
12692
|
+
);
|
|
12651
12693
|
filteredFeatures = filteredFeatures.filter(
|
|
12652
12694
|
(row) => row[searchFilterColumn] && String(row[searchFilterColumn]).toLowerCase().includes(String(searchFilterText).toLowerCase())
|
|
12653
12695
|
);
|
|
@@ -14445,7 +14487,7 @@ function parseMap(json) {
|
|
|
14445
14487
|
const { keplerMapConfig, datasets, token } = json;
|
|
14446
14488
|
assert2(keplerMapConfig.version === "v1", "Only support Kepler v1");
|
|
14447
14489
|
const config2 = keplerMapConfig.config;
|
|
14448
|
-
const { filters, mapState, mapStyle, popupSettings } = config2;
|
|
14490
|
+
const { filters, mapState, mapStyle, popupSettings, legendSettings } = config2;
|
|
14449
14491
|
const { layers, layerBlending, interactionConfig } = config2.visState;
|
|
14450
14492
|
return {
|
|
14451
14493
|
id: json.id,
|
|
@@ -14457,6 +14499,7 @@ function parseMap(json) {
|
|
|
14457
14499
|
/** @deprecated Use `basemap`. */
|
|
14458
14500
|
mapStyle,
|
|
14459
14501
|
popupSettings,
|
|
14502
|
+
legendSettings,
|
|
14460
14503
|
token,
|
|
14461
14504
|
layers: layers.reverse().map(({ id, type, config: config3, visualChannels }) => {
|
|
14462
14505
|
try {
|
|
@@ -15175,64 +15218,6 @@ async function fetchMap({
|
|
|
15175
15218
|
return out;
|
|
15176
15219
|
}
|
|
15177
15220
|
|
|
15178
|
-
// src/filters.ts
|
|
15179
|
-
function addFilter(filters, { column, type, values, owner }) {
|
|
15180
|
-
if (!filters[column]) {
|
|
15181
|
-
filters[column] = {};
|
|
15182
|
-
}
|
|
15183
|
-
const filter = { values, owner };
|
|
15184
|
-
filters[column][type] = filter;
|
|
15185
|
-
return filters;
|
|
15186
|
-
}
|
|
15187
|
-
function removeFilter(filters, { column, owner }) {
|
|
15188
|
-
const filter = filters[column];
|
|
15189
|
-
if (!filter) {
|
|
15190
|
-
return filters;
|
|
15191
|
-
}
|
|
15192
|
-
if (owner) {
|
|
15193
|
-
for (const type of Object.values(FilterType)) {
|
|
15194
|
-
if (owner === filter[type]?.owner) {
|
|
15195
|
-
delete filter[type];
|
|
15196
|
-
}
|
|
15197
|
-
}
|
|
15198
|
-
}
|
|
15199
|
-
if (!owner || isEmptyObject(filter)) {
|
|
15200
|
-
delete filters[column];
|
|
15201
|
-
}
|
|
15202
|
-
return filters;
|
|
15203
|
-
}
|
|
15204
|
-
function clearFilters(filters) {
|
|
15205
|
-
for (const column of Object.keys(filters)) {
|
|
15206
|
-
delete filters[column];
|
|
15207
|
-
}
|
|
15208
|
-
return filters;
|
|
15209
|
-
}
|
|
15210
|
-
function hasFilter(filters, { column, owner }) {
|
|
15211
|
-
const filter = filters[column];
|
|
15212
|
-
if (!filter) {
|
|
15213
|
-
return false;
|
|
15214
|
-
}
|
|
15215
|
-
if (!owner) {
|
|
15216
|
-
return true;
|
|
15217
|
-
}
|
|
15218
|
-
for (const type of Object.values(FilterType)) {
|
|
15219
|
-
if (owner === filter[type]?.owner) {
|
|
15220
|
-
return true;
|
|
15221
|
-
}
|
|
15222
|
-
}
|
|
15223
|
-
return false;
|
|
15224
|
-
}
|
|
15225
|
-
function getFilter(filters, { column, type, owner }) {
|
|
15226
|
-
const filter = filters[column];
|
|
15227
|
-
if (!filter) {
|
|
15228
|
-
return null;
|
|
15229
|
-
}
|
|
15230
|
-
if (!owner || owner === filter[type]?.owner) {
|
|
15231
|
-
return filter[type] || null;
|
|
15232
|
-
}
|
|
15233
|
-
return null;
|
|
15234
|
-
}
|
|
15235
|
-
|
|
15236
15221
|
// node_modules/@turf/union/dist/esm/index.js
|
|
15237
15222
|
function union2(features, options = {}) {
|
|
15238
15223
|
const geoms = [];
|
|
@@ -15402,21 +15387,25 @@ export {
|
|
|
15402
15387
|
buildPublicMapUrl,
|
|
15403
15388
|
buildStatsUrl,
|
|
15404
15389
|
clearFilters,
|
|
15390
|
+
configureSource,
|
|
15405
15391
|
createPolygonSpatialFilter,
|
|
15406
15392
|
createViewportSpatialFilter,
|
|
15407
15393
|
fetchBasemapProps,
|
|
15408
15394
|
fetchMap,
|
|
15409
15395
|
filterFunctions,
|
|
15410
15396
|
geojsonFeatures,
|
|
15397
|
+
getApplicableFilters,
|
|
15411
15398
|
getClient,
|
|
15412
15399
|
getColorAccessor,
|
|
15413
15400
|
getColorValueAccessor,
|
|
15401
|
+
getColumnNameFromGeoColumn,
|
|
15414
15402
|
getDataFilterExtensionProps,
|
|
15415
15403
|
getFilter,
|
|
15416
15404
|
getIconUrlAccessor,
|
|
15417
15405
|
getLayerProps,
|
|
15418
15406
|
getMaxMarkerSize,
|
|
15419
15407
|
getSizeAccessor,
|
|
15408
|
+
getSpatialIndexFromGeoColumn,
|
|
15420
15409
|
getTextAccessor,
|
|
15421
15410
|
groupValuesByColumn,
|
|
15422
15411
|
groupValuesByDateColumn,
|
|
@@ -15436,6 +15425,7 @@ export {
|
|
|
15436
15425
|
rasterSource,
|
|
15437
15426
|
removeFilter,
|
|
15438
15427
|
requestWithParameters,
|
|
15428
|
+
scaleAggregationResLevel,
|
|
15439
15429
|
scatterPlot,
|
|
15440
15430
|
setClient,
|
|
15441
15431
|
tileFeatures,
|