@carto/api-client 0.4.9-alpha.0 → 0.4.10-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 +6 -1
- package/build/api-client.cjs +10409 -2202
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.modern.js +9955 -1938
- package/build/api-client.modern.js.map +1 -1
- package/build/constants-internal.d.ts +8 -0
- package/build/constants.d.ts +4 -1
- package/build/fetch-map/basemap-styles.d.ts +27 -0
- package/build/fetch-map/basemap.d.ts +17 -0
- package/build/fetch-map/fetch-map.d.ts +47 -0
- package/build/fetch-map/index.d.ts +7 -0
- package/build/fetch-map/layer-map.d.ts +28 -0
- package/build/fetch-map/parse-map.d.ts +39 -0
- package/build/fetch-map/source.d.ts +20 -0
- package/build/fetch-map/types.d.ts +220 -0
- package/build/fetch-map/utils.d.ts +18 -0
- package/build/index.d.ts +1 -0
- package/build/models/model.d.ts +0 -2
- package/build/sources/types.d.ts +4 -1
- package/build/types.d.ts +2 -0
- package/build/widget-sources/types.d.ts +7 -0
- package/package.json +24 -21
- package/src/constants-internal.ts +10 -0
- package/src/constants.ts +5 -1
- package/src/fetch-map/basemap-styles.ts +159 -0
- package/src/fetch-map/basemap.ts +120 -0
- package/src/fetch-map/fetch-map.ts +331 -0
- package/src/fetch-map/index.ts +13 -0
- package/src/fetch-map/layer-map.ts +461 -0
- package/src/fetch-map/parse-map.ts +425 -0
- package/src/fetch-map/source.ts +233 -0
- package/src/fetch-map/types.ts +268 -0
- package/src/fetch-map/utils.ts +69 -0
- package/src/index.ts +1 -0
- package/src/models/model.ts +0 -2
- package/src/sources/types.ts +4 -1
- package/src/types.ts +10 -0
- package/src/widget-sources/types.ts +7 -0
- package/src/widget-sources/widget-source.ts +0 -2
|
@@ -14,6 +14,11 @@ export declare const DEFAULT_GEO_COLUMN = "geom";
|
|
|
14
14
|
export declare const DEFAULT_MAX_LENGTH_URL = 7000;
|
|
15
15
|
/** @privateRemarks Source: @deck.gl/carto */
|
|
16
16
|
export declare const DEFAULT_TILE_RESOLUTION = 0.5;
|
|
17
|
+
/**
|
|
18
|
+
* @todo TODO(v0.5): Update DEFAULT_TILE_RESOLUTION and remove this constant.
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare const REDUCED_QUERIES_TILE_RESOLUTION = 1;
|
|
17
22
|
/**
|
|
18
23
|
* @privateRemarks Source: @deck.gl/carto
|
|
19
24
|
* @internal
|
|
@@ -24,3 +29,6 @@ export declare const DEFAULT_AGGREGATION_RES_LEVEL_H3 = 4;
|
|
|
24
29
|
* @internal
|
|
25
30
|
*/
|
|
26
31
|
export declare const DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN = 6;
|
|
32
|
+
/** @internal */
|
|
33
|
+
export declare const DEFAULT_AGGREGATION_EXP_ALIAS = "__aggregationValue";
|
|
34
|
+
export declare const DEFAULT_AGGREGATION_EXP = "1 AS __aggregationValue";
|
package/build/constants.d.ts
CHANGED
|
@@ -39,7 +39,6 @@ export declare enum TileFormat {
|
|
|
39
39
|
/** @privateRemarks Source: @carto/react-core */
|
|
40
40
|
export declare enum SpatialIndex {
|
|
41
41
|
H3 = "h3",
|
|
42
|
-
S2 = "s2",
|
|
43
42
|
QUADBIN = "quadbin"
|
|
44
43
|
}
|
|
45
44
|
/** @privateRemarks Source: @carto/react-core */
|
|
@@ -51,3 +50,7 @@ export declare enum Provider {
|
|
|
51
50
|
DATABRICKS = "databricks",
|
|
52
51
|
DATABRICKS_REST = "databricksRest"
|
|
53
52
|
}
|
|
53
|
+
export declare const SpatialIndexColumn: Readonly<{
|
|
54
|
+
h3: string[];
|
|
55
|
+
quadbin: string[];
|
|
56
|
+
}>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { APIErrorContext } from '../api/index.js';
|
|
2
|
+
import { GoogleBasemapProps } from './types.js';
|
|
3
|
+
export declare const CARTO_MAP_STYLES: string[];
|
|
4
|
+
export declare const GOOGLE_BASEMAPS: Record<string, GoogleBasemapProps>;
|
|
5
|
+
type StyleLayerGroupSlug = 'label' | 'road' | 'border' | 'building' | 'water' | 'land';
|
|
6
|
+
type StyleLayerGroup = {
|
|
7
|
+
slug: StyleLayerGroupSlug;
|
|
8
|
+
filter: (layer: any) => boolean;
|
|
9
|
+
defaultVisibility: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare const STYLE_LAYER_GROUPS: StyleLayerGroup[];
|
|
12
|
+
export declare function applyLayerGroupFilters(style: any, visibleLayerGroups: Record<StyleLayerGroupSlug, boolean>): any;
|
|
13
|
+
export declare function someLayerGroupsDisabled(visibleLayerGroups?: Record<StyleLayerGroupSlug, boolean>): boolean | undefined;
|
|
14
|
+
export declare function getStyleUrl(styleType: string): string;
|
|
15
|
+
export declare function fetchStyle({ styleUrl, errorContext, }: {
|
|
16
|
+
styleUrl: string;
|
|
17
|
+
errorContext?: APIErrorContext;
|
|
18
|
+
}): Promise<any>;
|
|
19
|
+
declare const _default: {
|
|
20
|
+
readonly VOYAGER: string;
|
|
21
|
+
readonly POSITRON: string;
|
|
22
|
+
readonly DARK_MATTER: string;
|
|
23
|
+
readonly VOYAGER_NOLABELS: string;
|
|
24
|
+
readonly POSITRON_NOLABELS: string;
|
|
25
|
+
readonly DARK_MATTER_NOLABELS: string;
|
|
26
|
+
};
|
|
27
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Basemap, KeplerMapConfig } from './types.js';
|
|
2
|
+
import { APIErrorContext } from '../api/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Get basemap properties for Carto map.
|
|
5
|
+
*
|
|
6
|
+
* For maplibre-based basemaps it returns style or style URL that can be used with `maplibregl.Map` compatible component.
|
|
7
|
+
* * style url is returned for non-filtered standard Carto basemaps or if user used style URL directly in configuration
|
|
8
|
+
* * filtered style object returned for Carto basemaps with layer groups filtered
|
|
9
|
+
*
|
|
10
|
+
* For Google-maps base maps, it returns options that can be used with `google.maps.Map` constructor.
|
|
11
|
+
*/
|
|
12
|
+
export declare function fetchBasemapProps({ config, errorContext, applyLayerFilters, }: {
|
|
13
|
+
config: KeplerMapConfig;
|
|
14
|
+
/** By default `fetchBasemapProps` applies layers filters to style. Set this to `false` to disable it. */
|
|
15
|
+
applyLayerFilters?: boolean;
|
|
16
|
+
errorContext?: APIErrorContext;
|
|
17
|
+
}): Promise<Basemap | null>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ParseMapResult } from './parse-map.js';
|
|
2
|
+
import type { Basemap } from './types.js';
|
|
3
|
+
export type FetchMapOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* CARTO platform access token. Only required for private maps.
|
|
6
|
+
*/
|
|
7
|
+
accessToken?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Base URL of the CARTO Maps API.
|
|
10
|
+
*
|
|
11
|
+
* Example for account located in EU-west region: `https://gcp-eu-west1.api.carto.com`
|
|
12
|
+
*
|
|
13
|
+
* @default https://gcp-us-east1.api.carto.com
|
|
14
|
+
*/
|
|
15
|
+
apiBaseUrl?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Identifier of map created in CARTO Builder.
|
|
18
|
+
*/
|
|
19
|
+
cartoMapId: string;
|
|
20
|
+
clientId?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Custom HTTP headers added to map instantiation and data requests.
|
|
23
|
+
*/
|
|
24
|
+
headers?: Record<string, string>;
|
|
25
|
+
/**
|
|
26
|
+
* Interval in seconds at which to autoRefresh the data. If provided, `onNewData` must also be provided.
|
|
27
|
+
*/
|
|
28
|
+
autoRefresh?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Callback function that will be invoked whenever data in layers is changed. If provided, `autoRefresh` must also be provided.
|
|
31
|
+
*/
|
|
32
|
+
onNewData?: (map: any) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Maximum URL character length. Above this limit, requests use POST.
|
|
35
|
+
* Used to avoid browser and CDN limits.
|
|
36
|
+
* @default {@link DEFAULT_MAX_LENGTH_URL}
|
|
37
|
+
*/
|
|
38
|
+
maxLengthURL?: number;
|
|
39
|
+
};
|
|
40
|
+
export type FetchMapResult = ParseMapResult & {
|
|
41
|
+
/**
|
|
42
|
+
* Basemap properties.
|
|
43
|
+
*/
|
|
44
|
+
basemap: Basemap | null;
|
|
45
|
+
stopAutoRefresh?: () => void;
|
|
46
|
+
};
|
|
47
|
+
export declare function fetchMap({ accessToken, apiBaseUrl, cartoMapId, clientId, headers, autoRefresh, onNewData, maxLengthURL, }: FetchMapOptions): Promise<FetchMapResult>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as BASEMAP } from './basemap-styles.js';
|
|
2
|
+
export { fetchMap } from './fetch-map.js';
|
|
3
|
+
export type { FetchMapOptions, FetchMapResult } from './fetch-map.js';
|
|
4
|
+
export type { Basemap, MapLibreBasemap, GoogleBasemap, KeplerMapConfig, } from './types.js';
|
|
5
|
+
export * from './basemap.js';
|
|
6
|
+
export * from './layer-map.js';
|
|
7
|
+
export * from './parse-map.js';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type LayerType = 'clusterTile' | 'h3' | 'heatmapTile' | 'mvt' | 'quadbin' | 'raster' | 'tileset';
|
|
2
|
+
import { CustomMarkersRange, Dataset, MapLayerConfig, VisConfig, VisualChannelField, VisualChannels } from './types.js';
|
|
3
|
+
declare const SCALE_FUNCS: Record<string, () => any>;
|
|
4
|
+
export type SCALE_TYPE = keyof typeof SCALE_FUNCS;
|
|
5
|
+
export declare const AGGREGATION: Record<string, string>;
|
|
6
|
+
export declare const OPACITY_MAP: Record<string, string>;
|
|
7
|
+
export declare function getLayerProps(type: LayerType, config: MapLayerConfig, dataset: Dataset): {
|
|
8
|
+
propMap: any;
|
|
9
|
+
defaultProps: any;
|
|
10
|
+
};
|
|
11
|
+
declare function domainFromValues(values: any, scaleType: SCALE_TYPE): any;
|
|
12
|
+
export declare function opacityToAlpha(opacity?: number): number;
|
|
13
|
+
export declare function getColorValueAccessor({ name }: VisualChannelField, colorAggregation: string, data: any): any;
|
|
14
|
+
export declare function getColorAccessor({ name, colorColumn }: VisualChannelField, scaleType: SCALE_TYPE, { aggregation, range }: {
|
|
15
|
+
aggregation: string;
|
|
16
|
+
range: any;
|
|
17
|
+
}, opacity: number | undefined, data: any): any;
|
|
18
|
+
export declare function getIconUrlAccessor(field: VisualChannelField | null | undefined, range: CustomMarkersRange | null | undefined, { fallbackUrl, maxIconSize, useMaskedIcons, }: {
|
|
19
|
+
fallbackUrl?: string | null;
|
|
20
|
+
maxIconSize: number;
|
|
21
|
+
useMaskedIcons?: boolean;
|
|
22
|
+
}, data: any): any;
|
|
23
|
+
export declare function getMaxMarkerSize(visConfig: VisConfig, visualChannels: VisualChannels): number;
|
|
24
|
+
type Accessor = number | ((d: any, i: any) => number);
|
|
25
|
+
export declare function negateAccessor(accessor: Accessor): Accessor;
|
|
26
|
+
export declare function getSizeAccessor({ name }: VisualChannelField, scaleType: SCALE_TYPE | undefined, aggregation: string | null | undefined, range: Iterable<Range> | null | undefined, data: any): any;
|
|
27
|
+
export declare function getTextAccessor({ name, type }: VisualChannelField, data: any): any;
|
|
28
|
+
export { domainFromValues as _domainFromValues };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { LayerType } from './layer-map.js';
|
|
2
|
+
import { Filters } from '../types.js';
|
|
3
|
+
export type LayerDescriptor = {
|
|
4
|
+
type: LayerType;
|
|
5
|
+
props: Record<string, any>;
|
|
6
|
+
filters?: Filters;
|
|
7
|
+
};
|
|
8
|
+
export type ParseMapResult = {
|
|
9
|
+
/** Map id. */
|
|
10
|
+
id: string;
|
|
11
|
+
/** Title of map. */
|
|
12
|
+
title: string;
|
|
13
|
+
/** Description of map. */
|
|
14
|
+
description?: string;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
updatedAt: string;
|
|
17
|
+
initialViewState: any;
|
|
18
|
+
/** @deprecated Use `basemap`. */
|
|
19
|
+
mapStyle: any;
|
|
20
|
+
popupSettings: any;
|
|
21
|
+
token: string;
|
|
22
|
+
layers: LayerDescriptor[];
|
|
23
|
+
};
|
|
24
|
+
export declare function parseMap(json: any): {
|
|
25
|
+
id: any;
|
|
26
|
+
title: any;
|
|
27
|
+
description: any;
|
|
28
|
+
createdAt: any;
|
|
29
|
+
updatedAt: any;
|
|
30
|
+
initialViewState: any;
|
|
31
|
+
/** @deprecated Use `basemap`. */
|
|
32
|
+
mapStyle: {
|
|
33
|
+
styleType: string;
|
|
34
|
+
visibleLayerGroups: Record<string, boolean>;
|
|
35
|
+
};
|
|
36
|
+
popupSettings: any;
|
|
37
|
+
token: any;
|
|
38
|
+
layers: (LayerDescriptor | undefined)[];
|
|
39
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Dataset } from './types.js';
|
|
2
|
+
import { TilejsonResult } from '../sources/types.js';
|
|
3
|
+
import { Filter } from '../types.js';
|
|
4
|
+
type FetchDatasetOptions = {
|
|
5
|
+
accessToken: string;
|
|
6
|
+
apiBaseUrl: string;
|
|
7
|
+
connection: string;
|
|
8
|
+
headers?: Record<string, string>;
|
|
9
|
+
localCache?: {
|
|
10
|
+
cacheControl: 'no-cache'[];
|
|
11
|
+
};
|
|
12
|
+
maxLengthURL?: number;
|
|
13
|
+
};
|
|
14
|
+
type FetchDataset = {
|
|
15
|
+
dataset: Dataset;
|
|
16
|
+
filters?: Filter;
|
|
17
|
+
options: FetchDatasetOptions;
|
|
18
|
+
};
|
|
19
|
+
export declare function configureSource({ dataset, filters, options, }: FetchDataset): Promise<TilejsonResult>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { LayerType, SCALE_TYPE } from './layer-map.js';
|
|
2
|
+
import { Format, MapType, ProviderType, QueryParameters } from '../types.js';
|
|
3
|
+
import { TilejsonResult, GeojsonResult, JsonResult } from '../sources/types.js';
|
|
4
|
+
export type VisualChannelField = {
|
|
5
|
+
name: string;
|
|
6
|
+
type: string;
|
|
7
|
+
colorColumn?: string;
|
|
8
|
+
};
|
|
9
|
+
export type VisualChannels = {
|
|
10
|
+
colorField?: VisualChannelField;
|
|
11
|
+
colorScale?: SCALE_TYPE;
|
|
12
|
+
customMarkersField?: VisualChannelField;
|
|
13
|
+
customMarkersScale?: SCALE_TYPE;
|
|
14
|
+
radiusField?: VisualChannelField;
|
|
15
|
+
radiusScale?: SCALE_TYPE;
|
|
16
|
+
rotationScale?: SCALE_TYPE;
|
|
17
|
+
rotationField?: VisualChannelField;
|
|
18
|
+
sizeField?: VisualChannelField;
|
|
19
|
+
sizeScale?: SCALE_TYPE;
|
|
20
|
+
strokeColorField?: VisualChannelField;
|
|
21
|
+
strokeColorScale?: SCALE_TYPE;
|
|
22
|
+
heightField?: VisualChannelField;
|
|
23
|
+
heightScale?: SCALE_TYPE;
|
|
24
|
+
weightField?: VisualChannelField;
|
|
25
|
+
};
|
|
26
|
+
export type ColorRange = {
|
|
27
|
+
category: string;
|
|
28
|
+
colors: string[];
|
|
29
|
+
colorMap: string[][] | undefined;
|
|
30
|
+
name: string;
|
|
31
|
+
type: string;
|
|
32
|
+
};
|
|
33
|
+
export type CustomMarkersRange = {
|
|
34
|
+
markerMap: {
|
|
35
|
+
value: string;
|
|
36
|
+
markerUrl?: string;
|
|
37
|
+
}[];
|
|
38
|
+
othersMarker?: string;
|
|
39
|
+
};
|
|
40
|
+
export type VisConfig = {
|
|
41
|
+
filled?: boolean;
|
|
42
|
+
opacity?: number;
|
|
43
|
+
enable3d?: boolean;
|
|
44
|
+
colorAggregation?: any;
|
|
45
|
+
colorRange: ColorRange;
|
|
46
|
+
customMarkers?: boolean;
|
|
47
|
+
customMarkersRange?: CustomMarkersRange | null;
|
|
48
|
+
customMarkersUrl?: string | null;
|
|
49
|
+
radius: number;
|
|
50
|
+
radiusRange?: number[];
|
|
51
|
+
sizeAggregation?: any;
|
|
52
|
+
sizeRange?: any;
|
|
53
|
+
strokeColorAggregation?: any;
|
|
54
|
+
strokeOpacity?: number;
|
|
55
|
+
strokeColorRange?: ColorRange;
|
|
56
|
+
heightRange?: any;
|
|
57
|
+
heightAggregation?: any;
|
|
58
|
+
weightAggregation?: any;
|
|
59
|
+
};
|
|
60
|
+
export type TextLabel = {
|
|
61
|
+
field: VisualChannelField | null | undefined;
|
|
62
|
+
alignment?: 'center' | 'bottom' | 'top';
|
|
63
|
+
anchor?: 'middle' | 'start' | 'end';
|
|
64
|
+
size: number;
|
|
65
|
+
color?: number[];
|
|
66
|
+
offset?: [number, number];
|
|
67
|
+
outlineColor?: number[];
|
|
68
|
+
};
|
|
69
|
+
export type MapLayerConfig = {
|
|
70
|
+
columns?: Record<string, any>;
|
|
71
|
+
color?: number[];
|
|
72
|
+
label?: string;
|
|
73
|
+
dataId: string;
|
|
74
|
+
textLabel: TextLabel[];
|
|
75
|
+
visConfig: VisConfig;
|
|
76
|
+
};
|
|
77
|
+
export type MapConfigLayer = {
|
|
78
|
+
type: LayerType;
|
|
79
|
+
id: string;
|
|
80
|
+
config: MapLayerConfig;
|
|
81
|
+
visualChannels: VisualChannels;
|
|
82
|
+
};
|
|
83
|
+
export interface CustomStyle {
|
|
84
|
+
url?: string;
|
|
85
|
+
style?: any;
|
|
86
|
+
customAttribution?: string;
|
|
87
|
+
}
|
|
88
|
+
export type KeplerMapConfig = {
|
|
89
|
+
filters: any;
|
|
90
|
+
mapState: any;
|
|
91
|
+
mapStyle: {
|
|
92
|
+
styleType: string;
|
|
93
|
+
visibleLayerGroups: Record<string, boolean>;
|
|
94
|
+
};
|
|
95
|
+
popupSettings: any;
|
|
96
|
+
visState: {
|
|
97
|
+
layers: MapConfigLayer[];
|
|
98
|
+
layerBlending: any;
|
|
99
|
+
interactionConfig: any;
|
|
100
|
+
};
|
|
101
|
+
customBaseMaps?: {
|
|
102
|
+
customStyle?: CustomStyle;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
export type BasemapType = 'maplibre' | 'google-maps';
|
|
106
|
+
export type Basemap = MapLibreBasemap | GoogleBasemap;
|
|
107
|
+
export type BasemapCommon = {
|
|
108
|
+
/**
|
|
109
|
+
* Type of basemap.
|
|
110
|
+
*/
|
|
111
|
+
type: BasemapType;
|
|
112
|
+
/**
|
|
113
|
+
* Custom attribution for style data if not provided by style definition.
|
|
114
|
+
*/
|
|
115
|
+
attribution?: string;
|
|
116
|
+
/**
|
|
117
|
+
* Properties of the basemap. These properties are specific to the basemap type.
|
|
118
|
+
*/
|
|
119
|
+
props: Record<string, any>;
|
|
120
|
+
};
|
|
121
|
+
export type MapLibreBasemap = BasemapCommon & {
|
|
122
|
+
type: 'maplibre';
|
|
123
|
+
/**
|
|
124
|
+
* MapLibre map properties.
|
|
125
|
+
*
|
|
126
|
+
* Meant to be passed to directly to `maplibregl.Map` object.
|
|
127
|
+
*/
|
|
128
|
+
props: MapLibreBasemapProps;
|
|
129
|
+
/**
|
|
130
|
+
* Layer groups to be displayed in the basemap.
|
|
131
|
+
*/
|
|
132
|
+
visibleLayerGroups?: Record<string, boolean>;
|
|
133
|
+
/**
|
|
134
|
+
* If `style` has been filtered by `visibleLayerGroups` then this property contains original style object, so user
|
|
135
|
+
* can use `applyLayerGroupFilters` again with new settings.
|
|
136
|
+
*/
|
|
137
|
+
rawStyle?: string | Record<string, any>;
|
|
138
|
+
};
|
|
139
|
+
export type MapLibreBasemapProps = {
|
|
140
|
+
style: string | Record<string, any>;
|
|
141
|
+
center: [number, number];
|
|
142
|
+
zoom: number;
|
|
143
|
+
pitch?: number;
|
|
144
|
+
bearing?: number;
|
|
145
|
+
};
|
|
146
|
+
export type GoogleBasemap = BasemapCommon & {
|
|
147
|
+
type: 'google-maps';
|
|
148
|
+
/**
|
|
149
|
+
* Google map properties.
|
|
150
|
+
*
|
|
151
|
+
* Meant to be passed to directly to `google.maps.Map` object.
|
|
152
|
+
*/
|
|
153
|
+
props: GoogleBasemapProps;
|
|
154
|
+
};
|
|
155
|
+
export type GoogleBasemapProps = {
|
|
156
|
+
mapTypeId: string;
|
|
157
|
+
mapId?: string;
|
|
158
|
+
center?: {
|
|
159
|
+
lat: number;
|
|
160
|
+
lng: number;
|
|
161
|
+
};
|
|
162
|
+
zoom?: number;
|
|
163
|
+
tilt?: number;
|
|
164
|
+
heading?: number;
|
|
165
|
+
};
|
|
166
|
+
export type Dataset = {
|
|
167
|
+
id: string;
|
|
168
|
+
type: MapType;
|
|
169
|
+
source: string;
|
|
170
|
+
cache?: number;
|
|
171
|
+
connectionName: string;
|
|
172
|
+
geoColumn: string;
|
|
173
|
+
data: TilejsonResult | GeojsonResult | JsonResult;
|
|
174
|
+
columns: string[];
|
|
175
|
+
format: Format;
|
|
176
|
+
aggregationExp: string;
|
|
177
|
+
aggregationResLevel: number;
|
|
178
|
+
queryParameters: QueryParameters;
|
|
179
|
+
connectionId?: string;
|
|
180
|
+
providerId: ProviderType;
|
|
181
|
+
createdAt?: string;
|
|
182
|
+
updatedAt?: string;
|
|
183
|
+
label?: string;
|
|
184
|
+
color?: string;
|
|
185
|
+
uniqueIdProperty?: string;
|
|
186
|
+
queryTemplate?: string | null;
|
|
187
|
+
name?: string | null;
|
|
188
|
+
spatialIndex?: string | null;
|
|
189
|
+
exportToBucketAvailable?: boolean;
|
|
190
|
+
};
|
|
191
|
+
export type AttributeType = 'String' | 'Number' | 'Timestamp' | 'Boolean';
|
|
192
|
+
export type AttributeStatsBase = {
|
|
193
|
+
attribute: string;
|
|
194
|
+
type: AttributeType;
|
|
195
|
+
};
|
|
196
|
+
export type AttributeStatsNumber = AttributeStatsBase & {
|
|
197
|
+
type: 'Number';
|
|
198
|
+
min: number;
|
|
199
|
+
avg: number;
|
|
200
|
+
max: number;
|
|
201
|
+
sum: number;
|
|
202
|
+
quantiles: number[][];
|
|
203
|
+
};
|
|
204
|
+
export type AttributeStatsTimestamp = AttributeStatsBase & {
|
|
205
|
+
type: 'Timestamp';
|
|
206
|
+
min: string;
|
|
207
|
+
max: string;
|
|
208
|
+
};
|
|
209
|
+
export interface AttributeStatsStringCategory {
|
|
210
|
+
category: string;
|
|
211
|
+
frequency: number;
|
|
212
|
+
}
|
|
213
|
+
export type AttributeStatsString = AttributeStatsBase & {
|
|
214
|
+
type: 'String' | 'Boolean';
|
|
215
|
+
categories: AttributeStatsStringCategory[];
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Result of getAttributeStats request to backend.
|
|
219
|
+
*/
|
|
220
|
+
export type AttributeStats = AttributeStatsString | AttributeStatsNumber | AttributeStatsTimestamp;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BinaryFeature } from '@loaders.gl/schema';
|
|
2
|
+
import type { Dataset } from './types.js';
|
|
3
|
+
type Properties = BinaryFeature['properties'];
|
|
4
|
+
type NumericProps = BinaryFeature['numericProps'];
|
|
5
|
+
export declare function createBinaryProxy(data: {
|
|
6
|
+
numericProps: NumericProps;
|
|
7
|
+
properties: Properties[];
|
|
8
|
+
}, index: number): object[];
|
|
9
|
+
export declare function scaleIdentity(): {
|
|
10
|
+
(x: any): any;
|
|
11
|
+
invert: /*elided*/ any;
|
|
12
|
+
domain: (d: any) => any;
|
|
13
|
+
range(d: any): any;
|
|
14
|
+
unknown(u: any): any;
|
|
15
|
+
copy(): /*elided*/ any;
|
|
16
|
+
};
|
|
17
|
+
export declare function isRemoteCalculationSupported(dataset: Dataset): boolean;
|
|
18
|
+
export {};
|
package/build/index.d.ts
CHANGED
package/build/models/model.d.ts
CHANGED
|
@@ -20,8 +20,6 @@ export interface ModelSource {
|
|
|
20
20
|
spatialDataColumn?: string;
|
|
21
21
|
spatialDataType?: SpatialDataType;
|
|
22
22
|
spatialFiltersMode?: SpatialFilterPolyfillMode;
|
|
23
|
-
/** original resolution of the spatial index data as stored in the DW */
|
|
24
|
-
dataResolution?: number;
|
|
25
23
|
}
|
|
26
24
|
/**
|
|
27
25
|
* Execute a SQL model request.
|
package/build/sources/types.d.ts
CHANGED
|
@@ -98,7 +98,10 @@ export type AggregationOptions = {
|
|
|
98
98
|
*/
|
|
99
99
|
aggregationResLevel?: number;
|
|
100
100
|
/**
|
|
101
|
-
*
|
|
101
|
+
* Deprecated parameter previously used for H3 and Quadbin widgets. Now has
|
|
102
|
+
* no effect and will be removed in a future version.
|
|
103
|
+
* @deprecated Parameter has no effect.
|
|
104
|
+
* @todo TODO(v0.5): Remove spatialIndexReferenceViewState parameter.
|
|
102
105
|
*/
|
|
103
106
|
dataResolution?: number;
|
|
104
107
|
};
|
package/build/types.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ import type { BinaryFeature, BinaryFeatureCollection } from '@loaders.gl/schema'
|
|
|
8
8
|
export type Format = 'json' | 'geojson' | 'tilejson';
|
|
9
9
|
/** @privateRemarks Source: @carto/constants, @deck.gl/carto */
|
|
10
10
|
export type MapType = 'boundary' | 'query' | 'table' | 'tileset' | 'raster';
|
|
11
|
+
/** @privateRemarks Source: cloud-native */
|
|
12
|
+
export type ProviderType = 'bigquery' | 'postgres' | 'snowflake' | 'redshift' | 'databricks' | 'carto' | 'carto_dw';
|
|
11
13
|
/**
|
|
12
14
|
* Alias for GeoJSON 'BBox' type, semantically representing a viewport.
|
|
13
15
|
* Order of values is "west", "south", "east", "north".
|
|
@@ -15,6 +15,13 @@ interface BaseRequestOptions {
|
|
|
15
15
|
signal?: AbortSignal;
|
|
16
16
|
spatialFilter?: SpatialFilter;
|
|
17
17
|
spatialFiltersMode?: SpatialFilterPolyfillMode;
|
|
18
|
+
/**
|
|
19
|
+
* Deprecated parameter previously used for H3 and Quadbin widgets. Now has
|
|
20
|
+
* no effect and will be removed in a future version.
|
|
21
|
+
* @deprecated Parameter has no effect.
|
|
22
|
+
* @todo TODO(v0.5): Remove spatialIndexReferenceViewState parameter.
|
|
23
|
+
*/
|
|
24
|
+
spatialIndexReferenceViewState?: ViewState;
|
|
18
25
|
/** Overrides source filters, if any. */
|
|
19
26
|
filters?: Filters;
|
|
20
27
|
filterOwner?: string;
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"homepage": "https://github.com/CartoDB/carto-api-client#readme",
|
|
9
9
|
"author": "Don McCurdy <donmccurdy@carto.com>",
|
|
10
10
|
"packageManager": "yarn@4.3.1",
|
|
11
|
-
"version": "0.4.
|
|
11
|
+
"version": "0.4.10-alpha.0",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
@@ -68,55 +68,58 @@
|
|
|
68
68
|
"@turf/invariant": "^7.2.0",
|
|
69
69
|
"@turf/union": "^7.2.0",
|
|
70
70
|
"@types/geojson": "^7946.0.16",
|
|
71
|
+
"d3-format": "^3.1.0",
|
|
71
72
|
"d3-scale": "^4.0.2",
|
|
72
73
|
"h3-js": "4.1.0"
|
|
73
74
|
},
|
|
74
75
|
"devDependencies": {
|
|
75
|
-
"@deck.gl/aggregation-layers": "~9.1.
|
|
76
|
-
"@deck.gl/carto": "~9.1.
|
|
77
|
-
"@deck.gl/core": "~9.1.
|
|
78
|
-
"@deck.gl/extensions": "~9.1.
|
|
79
|
-
"@deck.gl/geo-layers": "~9.1.
|
|
80
|
-
"@deck.gl/google-maps": "~9.1.
|
|
81
|
-
"@deck.gl/layers": "~9.1.
|
|
82
|
-
"@deck.gl/mapbox": "~9.1.
|
|
83
|
-
"@deck.gl/mesh-layers": "~9.1.
|
|
76
|
+
"@deck.gl/aggregation-layers": "~9.1.6",
|
|
77
|
+
"@deck.gl/carto": "~9.1.6",
|
|
78
|
+
"@deck.gl/core": "~9.1.6",
|
|
79
|
+
"@deck.gl/extensions": "~9.1.6",
|
|
80
|
+
"@deck.gl/geo-layers": "~9.1.6",
|
|
81
|
+
"@deck.gl/google-maps": "~9.1.6",
|
|
82
|
+
"@deck.gl/layers": "~9.1.6",
|
|
83
|
+
"@deck.gl/mapbox": "~9.1.6",
|
|
84
|
+
"@deck.gl/mesh-layers": "~9.1.6",
|
|
84
85
|
"@eslint/js": "^9.20.0",
|
|
85
86
|
"@googlemaps/js-api-loader": "^1.16.6",
|
|
86
87
|
"@lit/react": "^1.0.7",
|
|
87
88
|
"@lit/task": "^1.0.2",
|
|
88
89
|
"@loaders.gl/core": "^4.3.3",
|
|
89
|
-
"@luma.gl/core": "~9.1.
|
|
90
|
-
"@luma.gl/engine": "~9.1.
|
|
91
|
-
"@luma.gl/shadertools": "~9.1.
|
|
90
|
+
"@luma.gl/core": "~9.1.5",
|
|
91
|
+
"@luma.gl/engine": "~9.1.5",
|
|
92
|
+
"@luma.gl/shadertools": "~9.1.5",
|
|
93
|
+
"@luma.gl/webgl": "~9.1.5",
|
|
92
94
|
"@turf/buffer": "^7.2.0",
|
|
93
95
|
"@turf/random": "^7.2.0",
|
|
96
|
+
"@types/d3-format": "^3.0.4",
|
|
94
97
|
"@types/d3-scale": "^4.0.9",
|
|
95
98
|
"@types/json-schema": "^7.0.15",
|
|
96
99
|
"@types/react": "^18.3.18",
|
|
97
100
|
"@types/semver": "^7.5.8",
|
|
98
|
-
"@vitest/coverage-istanbul": "^3.0.
|
|
101
|
+
"@vitest/coverage-istanbul": "^3.0.9",
|
|
99
102
|
"@webcomponents/webcomponentsjs": "^2.8.0",
|
|
100
103
|
"concurrently": "^9.1.2",
|
|
101
104
|
"echarts": "^5.6.0",
|
|
102
|
-
"eslint": "^9.
|
|
105
|
+
"eslint": "^9.22.0",
|
|
103
106
|
"lit": "^3.2.1",
|
|
104
107
|
"lit-analyzer": "^2.0.3",
|
|
105
|
-
"maplibre-gl": "^5.
|
|
108
|
+
"maplibre-gl": "^5.2.0",
|
|
106
109
|
"microbundle": "^0.15.1",
|
|
107
|
-
"prettier": "^3.
|
|
110
|
+
"prettier": "^3.5.3",
|
|
108
111
|
"rimraf": "^6.0.1",
|
|
109
112
|
"semver": "^7.7.1",
|
|
110
113
|
"thenby": "^1.3.4",
|
|
111
114
|
"tinybench": "^3.1.1",
|
|
112
115
|
"typescript": "~5.8.2",
|
|
113
|
-
"typescript-eslint": "^8.
|
|
114
|
-
"vite": "^6.
|
|
115
|
-
"vitest": "3.0.
|
|
116
|
+
"typescript-eslint": "^8.26.1",
|
|
117
|
+
"vite": "^6.2.2",
|
|
118
|
+
"vitest": "3.0.9"
|
|
116
119
|
},
|
|
117
120
|
"resolutions": {
|
|
118
121
|
"@carto/api-client": "portal:./",
|
|
119
122
|
"rollup": "^4.20.0"
|
|
120
123
|
},
|
|
121
|
-
"stableVersion": "0.4.
|
|
124
|
+
"stableVersion": "0.4.9"
|
|
122
125
|
}
|
|
@@ -19,6 +19,12 @@ export const DEFAULT_MAX_LENGTH_URL = 7000;
|
|
|
19
19
|
/** @privateRemarks Source: @deck.gl/carto */
|
|
20
20
|
export const DEFAULT_TILE_RESOLUTION = 0.5;
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* @todo TODO(v0.5): Update DEFAULT_TILE_RESOLUTION and remove this constant.
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export const REDUCED_QUERIES_TILE_RESOLUTION = 1;
|
|
27
|
+
|
|
22
28
|
/**
|
|
23
29
|
* @privateRemarks Source: @deck.gl/carto
|
|
24
30
|
* @internal
|
|
@@ -30,3 +36,7 @@ export const DEFAULT_AGGREGATION_RES_LEVEL_H3 = 4;
|
|
|
30
36
|
* @internal
|
|
31
37
|
*/
|
|
32
38
|
export const DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN = 6;
|
|
39
|
+
|
|
40
|
+
/** @internal */
|
|
41
|
+
export const DEFAULT_AGGREGATION_EXP_ALIAS = '__aggregationValue';
|
|
42
|
+
export const DEFAULT_AGGREGATION_EXP = `1 AS ${DEFAULT_AGGREGATION_EXP_ALIAS}`;
|
package/src/constants.ts
CHANGED
|
@@ -43,7 +43,6 @@ export enum TileFormat {
|
|
|
43
43
|
/** @privateRemarks Source: @carto/react-core */
|
|
44
44
|
export enum SpatialIndex {
|
|
45
45
|
H3 = 'h3',
|
|
46
|
-
S2 = 's2',
|
|
47
46
|
QUADBIN = 'quadbin',
|
|
48
47
|
}
|
|
49
48
|
|
|
@@ -56,3 +55,8 @@ export enum Provider {
|
|
|
56
55
|
DATABRICKS = 'databricks',
|
|
57
56
|
DATABRICKS_REST = 'databricksRest',
|
|
58
57
|
}
|
|
58
|
+
|
|
59
|
+
export const SpatialIndexColumn = Object.freeze({
|
|
60
|
+
[SpatialIndex.H3]: ['h3', 'hex', 'h3id', 'hex_id', 'h3hex'],
|
|
61
|
+
[SpatialIndex.QUADBIN]: ['quadbin'],
|
|
62
|
+
});
|