@carto/api-client 0.5.4 → 0.5.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/CHANGELOG.md +5 -0
- package/build/api-client.cjs +114 -304
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +32 -16
- package/build/api-client.d.ts +32 -16
- package/build/api-client.js +114 -290
- package/build/api-client.js.map +1 -1
- package/package.json +3 -2
- package/src/fetch-map/layer-map.ts +33 -45
- package/src/fetch-map/parse-map.ts +97 -83
- package/src/fetch-map/types.ts +8 -8
- package/src/models/model.ts +9 -19
package/build/api-client.d.cts
CHANGED
|
@@ -688,9 +688,12 @@ declare function clearDefaultRequestCache(): void;
|
|
|
688
688
|
|
|
689
689
|
type LayerType = 'clusterTile' | 'h3' | 'heatmapTile' | 'mvt' | 'quadbin' | 'raster' | 'tileset';
|
|
690
690
|
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
691
|
+
type D3Scale = {
|
|
692
|
+
domain: (d?: any) => any[];
|
|
693
|
+
range: (d?: any) => any[];
|
|
694
|
+
unknown?: (d?: string) => any;
|
|
695
|
+
} & ((d: any) => any);
|
|
696
|
+
type ScaleType = 'linear' | 'ordinal' | 'log' | 'point' | 'quantile' | 'quantize' | 'sqrt' | 'custom' | 'identity';
|
|
694
697
|
declare const OPACITY_MAP: Record<string, string>;
|
|
695
698
|
/** @privateRemarks Source: Builder */
|
|
696
699
|
declare const TEXT_LABEL_INDEX = 0;
|
|
@@ -701,13 +704,15 @@ declare function getLayerProps(type: LayerType, config: MapLayerConfig, dataset:
|
|
|
701
704
|
propMap: any;
|
|
702
705
|
defaultProps: any;
|
|
703
706
|
};
|
|
704
|
-
declare function domainFromValues(values: any, scaleType:
|
|
707
|
+
declare function domainFromValues(values: any, scaleType: ScaleType): any;
|
|
705
708
|
declare function opacityToAlpha(opacity?: number): number;
|
|
706
|
-
declare function
|
|
707
|
-
declare function getColorAccessor({ name, colorColumn }: VisualChannelField, scaleType: SCALE_TYPE, { aggregation, range }: {
|
|
709
|
+
declare function getColorAccessor({ name, colorColumn }: VisualChannelField, scaleType: ScaleType, { aggregation, range }: {
|
|
708
710
|
aggregation: string;
|
|
709
711
|
range: any;
|
|
710
|
-
}, opacity: number | undefined, data: any):
|
|
712
|
+
}, opacity: number | undefined, data: any): {
|
|
713
|
+
accessor: any;
|
|
714
|
+
scale: any;
|
|
715
|
+
};
|
|
711
716
|
declare function getIconUrlAccessor(field: VisualChannelField | null | undefined, range: CustomMarkersRange | null | undefined, { fallbackUrl, maxIconSize, useMaskedIcons, }: {
|
|
712
717
|
fallbackUrl?: string | null;
|
|
713
718
|
maxIconSize: number;
|
|
@@ -716,7 +721,10 @@ declare function getIconUrlAccessor(field: VisualChannelField | null | undefined
|
|
|
716
721
|
declare function getMaxMarkerSize(visConfig: VisConfig, visualChannels: VisualChannels): number;
|
|
717
722
|
type Accessor = number | ((d: any, i: any) => number);
|
|
718
723
|
declare function negateAccessor(accessor: Accessor): Accessor;
|
|
719
|
-
declare function getSizeAccessor({ name }: VisualChannelField, scaleType:
|
|
724
|
+
declare function getSizeAccessor({ name }: VisualChannelField, scaleType: ScaleType | undefined, aggregation: string | null | undefined, range: Iterable<Range> | null | undefined, data: any): {
|
|
725
|
+
accessor: any;
|
|
726
|
+
scale: any;
|
|
727
|
+
};
|
|
720
728
|
declare function getTextAccessor({ name, type }: VisualChannelField, data: any): any;
|
|
721
729
|
|
|
722
730
|
/** @privateRemarks Source: Builder */
|
|
@@ -738,19 +746,19 @@ type VisualChannelField = {
|
|
|
738
746
|
};
|
|
739
747
|
type VisualChannels = {
|
|
740
748
|
colorField?: VisualChannelField;
|
|
741
|
-
colorScale?:
|
|
749
|
+
colorScale?: ScaleType;
|
|
742
750
|
customMarkersField?: VisualChannelField;
|
|
743
|
-
customMarkersScale?:
|
|
751
|
+
customMarkersScale?: ScaleType;
|
|
744
752
|
radiusField?: VisualChannelField;
|
|
745
|
-
radiusScale?:
|
|
746
|
-
rotationScale?:
|
|
753
|
+
radiusScale?: ScaleType;
|
|
754
|
+
rotationScale?: ScaleType;
|
|
747
755
|
rotationField?: VisualChannelField;
|
|
748
756
|
sizeField?: VisualChannelField;
|
|
749
|
-
sizeScale?:
|
|
757
|
+
sizeScale?: ScaleType;
|
|
750
758
|
strokeColorField?: VisualChannelField;
|
|
751
|
-
strokeColorScale?:
|
|
759
|
+
strokeColorScale?: ScaleType;
|
|
752
760
|
heightField?: VisualChannelField;
|
|
753
|
-
heightScale?:
|
|
761
|
+
heightScale?: ScaleType;
|
|
754
762
|
weightField?: VisualChannelField;
|
|
755
763
|
};
|
|
756
764
|
type ColorRange = {
|
|
@@ -931,10 +939,17 @@ declare const _default: {
|
|
|
931
939
|
readonly DARK_MATTER_NOLABELS: string;
|
|
932
940
|
};
|
|
933
941
|
|
|
942
|
+
type Scale = {
|
|
943
|
+
field: VisualChannelField;
|
|
944
|
+
domain: string[] | number[];
|
|
945
|
+
range: string[] | number[];
|
|
946
|
+
type: ScaleType;
|
|
947
|
+
};
|
|
934
948
|
type LayerDescriptor = {
|
|
935
949
|
type: LayerType;
|
|
936
950
|
props: Record<string, any>;
|
|
937
951
|
filters?: Filters;
|
|
952
|
+
scales: Record<ScaleKey, Scale>;
|
|
938
953
|
};
|
|
939
954
|
type ParseMapResult = {
|
|
940
955
|
/** Map id. */
|
|
@@ -969,6 +984,7 @@ declare function parseMap(json: any): {
|
|
|
969
984
|
token: any;
|
|
970
985
|
layers: (LayerDescriptor | undefined)[];
|
|
971
986
|
};
|
|
987
|
+
type ScaleKey = 'fillColor' | 'pointRadius' | 'lineColor' | 'elevation' | 'weight';
|
|
972
988
|
|
|
973
989
|
type FetchMapOptions = {
|
|
974
990
|
/**
|
|
@@ -1818,4 +1834,4 @@ declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined
|
|
|
1818
1834
|
*/
|
|
1819
1835
|
declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
|
|
1820
1836
|
|
|
1821
|
-
export {
|
|
1837
|
+
export { type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryRequestOptions, type CategoryResponse, type ColumnsOption, type D3Scale, DEFAULT_API_BASE_URL, FEATURE_GEOM_PROPERTY, type FeaturesRequestOptions, type FeaturesResponse, type FetchMapOptions, type FetchMapResult, type Filter, type FilterFunction, type FilterInterval, type FilterIntervalComplete, type FilterIntervalExtremum, type FilterLogicalOperator, type FilterOptions, FilterType, type Filters, type Format, type FormulaRequestOptions, type FormulaResponse, type GetFilterOptions, type GoogleBasemap, type GroupByFeature, type GroupDateType, type H3QuerySourceOptions, type H3QuerySourceResponse, type H3TableSourceOptions, type H3TableSourceResponse, type H3TilesetSourceOptions, type H3TilesetSourceResponse, type HasFilterOptions, type HistogramRequestOptions, type HistogramResponse, type KeplerMapConfig, type Layer, type LayerDescriptor, type LayerType, type MapLibreBasemap, type MapType, type NamedQueryParameter, OPACITY_MAP, type ParseMapResult, type PositionalQueryParameter, Provider, type ProviderType, type QuadbinQuerySourceOptions, type QuadbinQuerySourceResponse, type QuadbinTableSourceOptions, type QuadbinTableSourceResponse, type QuadbinTilesetSourceOptions, type QuadbinTilesetSourceResponse, type QueryOptions, type QueryParameterValue, type QueryParameters, type QueryResult, type QuerySourceOptions, type RangeRequestOptions, type RangeResponse, type Raster, RasterBandColorinterp, type RasterBandType, type RasterMetadata, type RasterMetadataBand, type RasterMetadataBandStats, type RasterSourceOptions, type RasterTile, type RemoveFilterOptions, SOURCE_DEFAULTS, type Scale, type ScaleKey, type ScaleType, type ScatterPlotFeature, type ScatterRequestOptions, type ScatterResponse, type SchemaField, SchemaFieldType, type SortColumnType, type SortDirection, type SourceOptionalOptions, type SourceOptions, type SourceRequiredOptions, type SpatialDataType, type SpatialFilter, type SpatialFilterPolyfillMode, SpatialIndex, SpatialIndexColumn, type SpatialIndexTile, type StringSearchOptions, TEXT_LABEL_INDEX, TEXT_NUMBER_FORMATTER, TEXT_OUTLINE_OPACITY, type TableRequestOptions, type TableResponse, type TableSourceOptions, type Tile, type TileFeatureExtractOptions, type TileFeatures, type TileFeaturesSpatialIndexOptions, TileFormat, type TileResolution, type Tilejson, type TilejsonResult, type TilesetSourceOptions, type Tilestats, type TimeSeriesRequestOptions, type TimeSeriesResponse, type VectorLayer, type VectorQuerySourceOptions, type VectorQuerySourceResponse, type VectorTableSourceOptions, type VectorTableSourceResponse, type VectorTilesetSourceOptions, type VectorTilesetSourceResponse, type ViewState, type Viewport, WidgetQuerySource, type WidgetQuerySourceResult, WidgetRasterSource, type WidgetRasterSourceProps, type WidgetRasterSourceResult, WidgetRemoteSource, type WidgetRemoteSourceProps, WidgetSource, type WidgetSourceProps, WidgetTableSource, type WidgetTableSourceResult, WidgetTilesetSource, type WidgetTilesetSourceProps, type WidgetTilesetSourceResult, type _DataFilterExtensionProps, _buildFeatureFilter, domainFromValues as _domainFromValues, _getHexagonResolution, addFilter, aggregate, aggregationFunctions, applyFilters, applySorting, boundaryQuerySource, boundaryTableSource, buildBinaryFeatureFilter, buildPublicMapUrl, buildStatsUrl, calculateClusterRadius, calculateClusterTextFontSize, clearDefaultRequestCache, clearFilters, configureSource, createPolygonSpatialFilter, createViewportSpatialFilter, fetchBasemapProps, fetchMap, filterFunctions, geojsonFeatures, getApplicableFilters, getClient, getColorAccessor, getColumnNameFromGeoColumn, getDataFilterExtensionProps, getDefaultAggregationExpColumnAliasForLayerType, getFilter, getIconUrlAccessor, getLayerProps, getMaxMarkerSize, getSizeAccessor, getSpatialIndexFromGeoColumn, getTextAccessor, groupValuesByColumn, groupValuesByDateColumn, h3QuerySource, h3TableSource, h3TilesetSource, hasFilter, histogram, makeIntervalComplete, negateAccessor, opacityToAlpha, parseMap, quadbinQuerySource, quadbinTableSource, quadbinTilesetSource, query, rasterSource, removeFilter, requestWithParameters, scaleAggregationResLevel, scatterPlot, setClient, tileFeatures, tileFeaturesGeometries, tileFeaturesSpatialIndex, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
|
package/build/api-client.d.ts
CHANGED
|
@@ -688,9 +688,12 @@ declare function clearDefaultRequestCache(): void;
|
|
|
688
688
|
|
|
689
689
|
type LayerType = 'clusterTile' | 'h3' | 'heatmapTile' | 'mvt' | 'quadbin' | 'raster' | 'tileset';
|
|
690
690
|
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
691
|
+
type D3Scale = {
|
|
692
|
+
domain: (d?: any) => any[];
|
|
693
|
+
range: (d?: any) => any[];
|
|
694
|
+
unknown?: (d?: string) => any;
|
|
695
|
+
} & ((d: any) => any);
|
|
696
|
+
type ScaleType = 'linear' | 'ordinal' | 'log' | 'point' | 'quantile' | 'quantize' | 'sqrt' | 'custom' | 'identity';
|
|
694
697
|
declare const OPACITY_MAP: Record<string, string>;
|
|
695
698
|
/** @privateRemarks Source: Builder */
|
|
696
699
|
declare const TEXT_LABEL_INDEX = 0;
|
|
@@ -701,13 +704,15 @@ declare function getLayerProps(type: LayerType, config: MapLayerConfig, dataset:
|
|
|
701
704
|
propMap: any;
|
|
702
705
|
defaultProps: any;
|
|
703
706
|
};
|
|
704
|
-
declare function domainFromValues(values: any, scaleType:
|
|
707
|
+
declare function domainFromValues(values: any, scaleType: ScaleType): any;
|
|
705
708
|
declare function opacityToAlpha(opacity?: number): number;
|
|
706
|
-
declare function
|
|
707
|
-
declare function getColorAccessor({ name, colorColumn }: VisualChannelField, scaleType: SCALE_TYPE, { aggregation, range }: {
|
|
709
|
+
declare function getColorAccessor({ name, colorColumn }: VisualChannelField, scaleType: ScaleType, { aggregation, range }: {
|
|
708
710
|
aggregation: string;
|
|
709
711
|
range: any;
|
|
710
|
-
}, opacity: number | undefined, data: any):
|
|
712
|
+
}, opacity: number | undefined, data: any): {
|
|
713
|
+
accessor: any;
|
|
714
|
+
scale: any;
|
|
715
|
+
};
|
|
711
716
|
declare function getIconUrlAccessor(field: VisualChannelField | null | undefined, range: CustomMarkersRange | null | undefined, { fallbackUrl, maxIconSize, useMaskedIcons, }: {
|
|
712
717
|
fallbackUrl?: string | null;
|
|
713
718
|
maxIconSize: number;
|
|
@@ -716,7 +721,10 @@ declare function getIconUrlAccessor(field: VisualChannelField | null | undefined
|
|
|
716
721
|
declare function getMaxMarkerSize(visConfig: VisConfig, visualChannels: VisualChannels): number;
|
|
717
722
|
type Accessor = number | ((d: any, i: any) => number);
|
|
718
723
|
declare function negateAccessor(accessor: Accessor): Accessor;
|
|
719
|
-
declare function getSizeAccessor({ name }: VisualChannelField, scaleType:
|
|
724
|
+
declare function getSizeAccessor({ name }: VisualChannelField, scaleType: ScaleType | undefined, aggregation: string | null | undefined, range: Iterable<Range> | null | undefined, data: any): {
|
|
725
|
+
accessor: any;
|
|
726
|
+
scale: any;
|
|
727
|
+
};
|
|
720
728
|
declare function getTextAccessor({ name, type }: VisualChannelField, data: any): any;
|
|
721
729
|
|
|
722
730
|
/** @privateRemarks Source: Builder */
|
|
@@ -738,19 +746,19 @@ type VisualChannelField = {
|
|
|
738
746
|
};
|
|
739
747
|
type VisualChannels = {
|
|
740
748
|
colorField?: VisualChannelField;
|
|
741
|
-
colorScale?:
|
|
749
|
+
colorScale?: ScaleType;
|
|
742
750
|
customMarkersField?: VisualChannelField;
|
|
743
|
-
customMarkersScale?:
|
|
751
|
+
customMarkersScale?: ScaleType;
|
|
744
752
|
radiusField?: VisualChannelField;
|
|
745
|
-
radiusScale?:
|
|
746
|
-
rotationScale?:
|
|
753
|
+
radiusScale?: ScaleType;
|
|
754
|
+
rotationScale?: ScaleType;
|
|
747
755
|
rotationField?: VisualChannelField;
|
|
748
756
|
sizeField?: VisualChannelField;
|
|
749
|
-
sizeScale?:
|
|
757
|
+
sizeScale?: ScaleType;
|
|
750
758
|
strokeColorField?: VisualChannelField;
|
|
751
|
-
strokeColorScale?:
|
|
759
|
+
strokeColorScale?: ScaleType;
|
|
752
760
|
heightField?: VisualChannelField;
|
|
753
|
-
heightScale?:
|
|
761
|
+
heightScale?: ScaleType;
|
|
754
762
|
weightField?: VisualChannelField;
|
|
755
763
|
};
|
|
756
764
|
type ColorRange = {
|
|
@@ -931,10 +939,17 @@ declare const _default: {
|
|
|
931
939
|
readonly DARK_MATTER_NOLABELS: string;
|
|
932
940
|
};
|
|
933
941
|
|
|
942
|
+
type Scale = {
|
|
943
|
+
field: VisualChannelField;
|
|
944
|
+
domain: string[] | number[];
|
|
945
|
+
range: string[] | number[];
|
|
946
|
+
type: ScaleType;
|
|
947
|
+
};
|
|
934
948
|
type LayerDescriptor = {
|
|
935
949
|
type: LayerType;
|
|
936
950
|
props: Record<string, any>;
|
|
937
951
|
filters?: Filters;
|
|
952
|
+
scales: Record<ScaleKey, Scale>;
|
|
938
953
|
};
|
|
939
954
|
type ParseMapResult = {
|
|
940
955
|
/** Map id. */
|
|
@@ -969,6 +984,7 @@ declare function parseMap(json: any): {
|
|
|
969
984
|
token: any;
|
|
970
985
|
layers: (LayerDescriptor | undefined)[];
|
|
971
986
|
};
|
|
987
|
+
type ScaleKey = 'fillColor' | 'pointRadius' | 'lineColor' | 'elevation' | 'weight';
|
|
972
988
|
|
|
973
989
|
type FetchMapOptions = {
|
|
974
990
|
/**
|
|
@@ -1818,4 +1834,4 @@ declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined
|
|
|
1818
1834
|
*/
|
|
1819
1835
|
declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
|
|
1820
1836
|
|
|
1821
|
-
export {
|
|
1837
|
+
export { type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryRequestOptions, type CategoryResponse, type ColumnsOption, type D3Scale, DEFAULT_API_BASE_URL, FEATURE_GEOM_PROPERTY, type FeaturesRequestOptions, type FeaturesResponse, type FetchMapOptions, type FetchMapResult, type Filter, type FilterFunction, type FilterInterval, type FilterIntervalComplete, type FilterIntervalExtremum, type FilterLogicalOperator, type FilterOptions, FilterType, type Filters, type Format, type FormulaRequestOptions, type FormulaResponse, type GetFilterOptions, type GoogleBasemap, type GroupByFeature, type GroupDateType, type H3QuerySourceOptions, type H3QuerySourceResponse, type H3TableSourceOptions, type H3TableSourceResponse, type H3TilesetSourceOptions, type H3TilesetSourceResponse, type HasFilterOptions, type HistogramRequestOptions, type HistogramResponse, type KeplerMapConfig, type Layer, type LayerDescriptor, type LayerType, type MapLibreBasemap, type MapType, type NamedQueryParameter, OPACITY_MAP, type ParseMapResult, type PositionalQueryParameter, Provider, type ProviderType, type QuadbinQuerySourceOptions, type QuadbinQuerySourceResponse, type QuadbinTableSourceOptions, type QuadbinTableSourceResponse, type QuadbinTilesetSourceOptions, type QuadbinTilesetSourceResponse, type QueryOptions, type QueryParameterValue, type QueryParameters, type QueryResult, type QuerySourceOptions, type RangeRequestOptions, type RangeResponse, type Raster, RasterBandColorinterp, type RasterBandType, type RasterMetadata, type RasterMetadataBand, type RasterMetadataBandStats, type RasterSourceOptions, type RasterTile, type RemoveFilterOptions, SOURCE_DEFAULTS, type Scale, type ScaleKey, type ScaleType, type ScatterPlotFeature, type ScatterRequestOptions, type ScatterResponse, type SchemaField, SchemaFieldType, type SortColumnType, type SortDirection, type SourceOptionalOptions, type SourceOptions, type SourceRequiredOptions, type SpatialDataType, type SpatialFilter, type SpatialFilterPolyfillMode, SpatialIndex, SpatialIndexColumn, type SpatialIndexTile, type StringSearchOptions, TEXT_LABEL_INDEX, TEXT_NUMBER_FORMATTER, TEXT_OUTLINE_OPACITY, type TableRequestOptions, type TableResponse, type TableSourceOptions, type Tile, type TileFeatureExtractOptions, type TileFeatures, type TileFeaturesSpatialIndexOptions, TileFormat, type TileResolution, type Tilejson, type TilejsonResult, type TilesetSourceOptions, type Tilestats, type TimeSeriesRequestOptions, type TimeSeriesResponse, type VectorLayer, type VectorQuerySourceOptions, type VectorQuerySourceResponse, type VectorTableSourceOptions, type VectorTableSourceResponse, type VectorTilesetSourceOptions, type VectorTilesetSourceResponse, type ViewState, type Viewport, WidgetQuerySource, type WidgetQuerySourceResult, WidgetRasterSource, type WidgetRasterSourceProps, type WidgetRasterSourceResult, WidgetRemoteSource, type WidgetRemoteSourceProps, WidgetSource, type WidgetSourceProps, WidgetTableSource, type WidgetTableSourceResult, WidgetTilesetSource, type WidgetTilesetSourceProps, type WidgetTilesetSourceResult, type _DataFilterExtensionProps, _buildFeatureFilter, domainFromValues as _domainFromValues, _getHexagonResolution, addFilter, aggregate, aggregationFunctions, applyFilters, applySorting, boundaryQuerySource, boundaryTableSource, buildBinaryFeatureFilter, buildPublicMapUrl, buildStatsUrl, calculateClusterRadius, calculateClusterTextFontSize, clearDefaultRequestCache, clearFilters, configureSource, createPolygonSpatialFilter, createViewportSpatialFilter, fetchBasemapProps, fetchMap, filterFunctions, geojsonFeatures, getApplicableFilters, getClient, getColorAccessor, getColumnNameFromGeoColumn, getDataFilterExtensionProps, getDefaultAggregationExpColumnAliasForLayerType, getFilter, getIconUrlAccessor, getLayerProps, getMaxMarkerSize, getSizeAccessor, getSpatialIndexFromGeoColumn, getTextAccessor, groupValuesByColumn, groupValuesByDateColumn, h3QuerySource, h3TableSource, h3TilesetSource, hasFilter, histogram, makeIntervalComplete, negateAccessor, opacityToAlpha, parseMap, quadbinQuerySource, quadbinTableSource, quadbinTilesetSource, query, rasterSource, removeFilter, requestWithParameters, scaleAggregationResLevel, scatterPlot, setClient, tileFeatures, tileFeaturesGeometries, tileFeaturesSpatialIndex, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
|