@carto/api-client 0.4.0-alpha.0 → 0.4.0-alpha.1
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/carto-api-error.d.ts +9 -1
- package/build/api/endpoints.d.ts +3 -1
- package/build/api/index.d.ts +5 -4
- package/build/api/request-with-parameters.d.ts +1 -1
- package/build/api-client.cjs +256 -59
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.modern.js +207 -53
- package/build/api-client.modern.js.map +1 -1
- package/build/constants-internal.d.ts +9 -28
- package/build/constants.d.ts +24 -10
- package/build/index.d.ts +4 -5
- package/build/models/model.d.ts +2 -2
- package/build/sources/base-source.d.ts +1 -1
- package/build/sources/boundary-query-source.d.ts +1 -1
- package/build/sources/index.d.ts +1 -1
- package/build/sources/types.d.ts +2 -1
- package/build/types-internal.d.ts +46 -1
- package/build/types.d.ts +11 -0
- package/build/widget-sources/widget-base-source.d.ts +1 -1
- package/package.json +1 -1
- package/src/api/carto-api-error.ts +17 -1
- package/src/api/endpoints.ts +3 -1
- package/src/api/index.ts +9 -12
- package/src/api/query.ts +1 -1
- package/src/api/request-with-parameters.ts +3 -7
- package/src/constants-internal.ts +9 -30
- package/src/constants.ts +32 -16
- package/src/index.ts +33 -5
- package/src/models/model.ts +4 -6
- package/src/sources/base-source.ts +2 -1
- package/src/sources/boundary-query-source.ts +1 -1
- package/src/sources/h3-query-source.ts +1 -1
- package/src/sources/h3-table-source.ts +1 -1
- package/src/sources/index.ts +6 -1
- package/src/sources/quadbin-query-source.ts +1 -1
- package/src/sources/quadbin-table-source.ts +1 -1
- package/src/sources/types.ts +2 -6
- package/src/sources/vector-query-source.ts +1 -1
- package/src/sources/vector-table-source.ts +1 -1
- package/src/types-internal.ts +54 -1
- package/src/types.ts +16 -0
- package/src/widget-sources/widget-base-source.ts +5 -5
- package/src/widget-sources/widget-query-source.ts +1 -2
- package/src/widget-sources/widget-table-source.ts +1 -2
- package/src/widget-sources/wrappers.ts +0 -1
- package/build/api/types.d.ts +0 -227
- package/src/api/types.ts +0 -301
package/src/types-internal.ts
CHANGED
|
@@ -1,9 +1,62 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
|
-
*
|
|
2
|
+
* COMMON
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import {Format} from './types';
|
|
6
|
+
|
|
5
7
|
/** @internal */
|
|
6
8
|
export type $TODO = any;
|
|
7
9
|
|
|
8
10
|
/** @internal */
|
|
9
11
|
export type $IntentionalAny = any;
|
|
12
|
+
|
|
13
|
+
/******************************************************************************
|
|
14
|
+
* MAP INSTANTIATION
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @internalRemarks Source: @deck.gl/carto
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export enum SchemaFieldType {
|
|
22
|
+
Number = 'number',
|
|
23
|
+
Bigint = 'bigint',
|
|
24
|
+
String = 'string',
|
|
25
|
+
Geometry = 'geometry',
|
|
26
|
+
Timestamp = 'timestamp',
|
|
27
|
+
Object = 'object',
|
|
28
|
+
Boolean = 'boolean',
|
|
29
|
+
Variant = 'variant',
|
|
30
|
+
Unknown = 'unknown',
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @internalRemarks Source: @deck.gl/carto
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
export interface SchemaField {
|
|
38
|
+
name: string;
|
|
39
|
+
type: SchemaFieldType; // Field type in the CARTO stack, common for all providers
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @internalRemarks Source: @deck.gl/carto
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
export interface MapInstantiation extends MapInstantiationFormats {
|
|
47
|
+
nrows: number;
|
|
48
|
+
size?: number;
|
|
49
|
+
schema: SchemaField[];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @internalRemarks Source: @deck.gl/carto
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
type MapInstantiationFormats = Record<
|
|
57
|
+
Format,
|
|
58
|
+
{
|
|
59
|
+
url: string[];
|
|
60
|
+
error?: any;
|
|
61
|
+
}
|
|
62
|
+
>;
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import type {FilterType} from './constants.js';
|
|
2
2
|
import type {Polygon, MultiPolygon} from 'geojson';
|
|
3
3
|
|
|
4
|
+
/******************************************************************************
|
|
5
|
+
* MAPS AND TILES
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** @internalRemarks Source: @deck.gl/carto */
|
|
9
|
+
export type Format = 'json' | 'geojson' | 'tilejson';
|
|
10
|
+
|
|
11
|
+
/** @internalRemarks Source: @carto/constants, @deck.gl/carto */
|
|
12
|
+
export type MapType = 'boundary' | 'query' | 'table' | 'tileset' | 'raster';
|
|
13
|
+
|
|
4
14
|
/******************************************************************************
|
|
5
15
|
* AGGREGATION
|
|
6
16
|
*/
|
|
@@ -26,6 +36,12 @@ export type AggregationType =
|
|
|
26
36
|
/** @internalRemarks Source: @carto/react-api */
|
|
27
37
|
export type SpatialFilter = Polygon | MultiPolygon;
|
|
28
38
|
|
|
39
|
+
/** @internalRemarks Source: @deck.gl/carto */
|
|
40
|
+
export interface Filters {
|
|
41
|
+
[column: string]: Filter;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// TODO: Would `{[FilterType.IN]?: number[] | string[]}` also be valid?
|
|
29
45
|
/** @internalRemarks Source: @carto/react-api, @deck.gl/carto */
|
|
30
46
|
export interface Filter {
|
|
31
47
|
[FilterType.IN]?: {owner?: string; values: number[] | string[]};
|
|
@@ -17,14 +17,14 @@ import {
|
|
|
17
17
|
} from './types.js';
|
|
18
18
|
import {FilterLogicalOperator, Filter} from '../types.js';
|
|
19
19
|
import {getApplicableFilters, normalizeObjectKeys} from '../utils.js';
|
|
20
|
-
import {
|
|
21
|
-
DEFAULT_API_BASE_URL,
|
|
22
|
-
DEFAULT_GEO_COLUMN,
|
|
23
|
-
ApiVersion,
|
|
24
|
-
} from '../constants-internal.js';
|
|
25
20
|
import {getClient} from '../client.js';
|
|
26
21
|
import {ModelSource} from '../models/model.js';
|
|
27
22
|
import {SourceOptions} from '../sources/index.js';
|
|
23
|
+
import {
|
|
24
|
+
ApiVersion,
|
|
25
|
+
DEFAULT_API_BASE_URL,
|
|
26
|
+
DEFAULT_GEO_COLUMN,
|
|
27
|
+
} from '../constants.js';
|
|
28
28
|
|
|
29
29
|
export interface WidgetBaseSourceProps extends Omit<SourceOptions, 'filters'> {
|
|
30
30
|
apiVersion?: ApiVersion;
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
QuadbinQuerySourceOptions,
|
|
4
4
|
VectorQuerySourceOptions,
|
|
5
5
|
} from '../sources/index.js';
|
|
6
|
-
import {MapType} from '../constants-internal.js';
|
|
7
6
|
import {WidgetBaseSource, WidgetBaseSourceProps} from './widget-base-source.js';
|
|
8
7
|
import {ModelSource} from '../models/model.js';
|
|
9
8
|
|
|
@@ -40,7 +39,7 @@ export class WidgetQuerySource extends WidgetBaseSource<
|
|
|
40
39
|
protected override getModelSource(owner: string): ModelSource {
|
|
41
40
|
return {
|
|
42
41
|
...super._getModelSource(owner),
|
|
43
|
-
type:
|
|
42
|
+
type: 'query',
|
|
44
43
|
data: this.props.sqlQuery,
|
|
45
44
|
queryParameters: this.props.queryParameters,
|
|
46
45
|
};
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
VectorTableSourceOptions,
|
|
5
5
|
} from '../sources/index.js';
|
|
6
6
|
import {WidgetBaseSource, WidgetBaseSourceProps} from './widget-base-source.js';
|
|
7
|
-
import {MapType} from '../constants-internal.js';
|
|
8
7
|
import {ModelSource} from '../models/model.js';
|
|
9
8
|
|
|
10
9
|
type LayerTableSourceOptions =
|
|
@@ -40,7 +39,7 @@ export class WidgetTableSource extends WidgetBaseSource<
|
|
|
40
39
|
protected override getModelSource(owner: string): ModelSource {
|
|
41
40
|
return {
|
|
42
41
|
...super._getModelSource(owner),
|
|
43
|
-
type:
|
|
42
|
+
type: 'table',
|
|
44
43
|
data: this.props.tableName,
|
|
45
44
|
};
|
|
46
45
|
}
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
H3QuerySourceOptions as _H3QuerySourceOptions,
|
|
12
12
|
QuadbinTableSourceOptions as _QuadbinTableSourceOptions,
|
|
13
13
|
QuadbinQuerySourceOptions as _QuadbinQuerySourceOptions,
|
|
14
|
-
SourceOptions,
|
|
15
14
|
} from '../sources/index.js';
|
|
16
15
|
import {WidgetBaseSourceProps} from './widget-base-source.js';
|
|
17
16
|
import {WidgetQuerySource} from './widget-query-source.js';
|
package/build/api/types.d.ts
DELETED
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
export type Format = 'json' | 'geojson' | 'tilejson';
|
|
2
|
-
export type MapType = 'boundary' | 'query' | 'table' | 'tileset' | 'raster';
|
|
3
|
-
export type RequestType = 'Map data' | 'Map instantiation' | 'Public map' | 'Tile stats' | 'SQL' | 'Basemap style';
|
|
4
|
-
export type ScaleType = 'linear' | 'ordinal' | 'log' | 'point' | 'quantile' | 'quantize' | 'sqrt' | 'custom' | 'identity';
|
|
5
|
-
export type APIErrorContext = {
|
|
6
|
-
requestType: RequestType;
|
|
7
|
-
mapId?: string;
|
|
8
|
-
connection?: string;
|
|
9
|
-
source?: string;
|
|
10
|
-
type?: MapType;
|
|
11
|
-
};
|
|
12
|
-
export declare enum SchemaFieldType {
|
|
13
|
-
Number = "number",
|
|
14
|
-
Bigint = "bigint",
|
|
15
|
-
String = "string",
|
|
16
|
-
Geometry = "geometry",
|
|
17
|
-
Timestamp = "timestamp",
|
|
18
|
-
Object = "object",
|
|
19
|
-
Boolean = "boolean",
|
|
20
|
-
Variant = "variant",
|
|
21
|
-
Unknown = "unknown"
|
|
22
|
-
}
|
|
23
|
-
export interface SchemaField {
|
|
24
|
-
name: string;
|
|
25
|
-
type: SchemaFieldType;
|
|
26
|
-
}
|
|
27
|
-
export interface MapInstantiation extends MapInstantiationFormats {
|
|
28
|
-
nrows: number;
|
|
29
|
-
size?: number;
|
|
30
|
-
schema: SchemaField[];
|
|
31
|
-
}
|
|
32
|
-
type MapInstantiationFormats = Record<Format, {
|
|
33
|
-
url: string[];
|
|
34
|
-
error?: any;
|
|
35
|
-
}>;
|
|
36
|
-
export type QueryParameterValue = string | number | boolean | Array<QueryParameterValue> | object;
|
|
37
|
-
export type NamedQueryParameter = Record<string, QueryParameterValue>;
|
|
38
|
-
export type PositionalQueryParameter = QueryParameterValue[];
|
|
39
|
-
export type QueryParameters = NamedQueryParameter | PositionalQueryParameter;
|
|
40
|
-
export type VisualChannelField = {
|
|
41
|
-
name: string;
|
|
42
|
-
type: string;
|
|
43
|
-
colorColumn?: string;
|
|
44
|
-
};
|
|
45
|
-
export interface Filters {
|
|
46
|
-
[column: string]: Filter;
|
|
47
|
-
}
|
|
48
|
-
interface Filter {
|
|
49
|
-
[FilterTypes.In]?: number[];
|
|
50
|
-
[FilterTypes.Between]?: number[][];
|
|
51
|
-
[FilterTypes.ClosedOpen]?: number[][];
|
|
52
|
-
[FilterTypes.Time]?: number[][];
|
|
53
|
-
[FilterTypes.StringSearch]?: string[];
|
|
54
|
-
}
|
|
55
|
-
export declare enum FilterTypes {
|
|
56
|
-
In = "in",
|
|
57
|
-
Between = "between",// [a, b] both are included
|
|
58
|
-
ClosedOpen = "closed_open",// [a, b) a is included, b is not
|
|
59
|
-
Time = "time",
|
|
60
|
-
StringSearch = "stringSearch"
|
|
61
|
-
}
|
|
62
|
-
export type VisualChannels = {
|
|
63
|
-
colorField?: VisualChannelField;
|
|
64
|
-
colorScale?: ScaleType;
|
|
65
|
-
customMarkersField?: VisualChannelField;
|
|
66
|
-
customMarkersScale?: ScaleType;
|
|
67
|
-
radiusField?: VisualChannelField;
|
|
68
|
-
radiusScale?: ScaleType;
|
|
69
|
-
rotationScale?: ScaleType;
|
|
70
|
-
rotationField?: VisualChannelField;
|
|
71
|
-
sizeField?: VisualChannelField;
|
|
72
|
-
sizeScale?: ScaleType;
|
|
73
|
-
strokeColorField?: VisualChannelField;
|
|
74
|
-
strokeColorScale?: ScaleType;
|
|
75
|
-
heightField?: VisualChannelField;
|
|
76
|
-
heightScale?: ScaleType;
|
|
77
|
-
weightField?: VisualChannelField;
|
|
78
|
-
};
|
|
79
|
-
export type ColorRange = {
|
|
80
|
-
category: string;
|
|
81
|
-
colors: string[];
|
|
82
|
-
colorMap: string[][] | undefined;
|
|
83
|
-
name: string;
|
|
84
|
-
type: string;
|
|
85
|
-
};
|
|
86
|
-
export type CustomMarkersRange = {
|
|
87
|
-
markerMap: {
|
|
88
|
-
value: string;
|
|
89
|
-
markerUrl?: string;
|
|
90
|
-
}[];
|
|
91
|
-
othersMarker?: string;
|
|
92
|
-
};
|
|
93
|
-
export type VisConfig = {
|
|
94
|
-
filled?: boolean;
|
|
95
|
-
opacity?: number;
|
|
96
|
-
enable3d?: boolean;
|
|
97
|
-
colorAggregation?: any;
|
|
98
|
-
colorRange: ColorRange;
|
|
99
|
-
customMarkers?: boolean;
|
|
100
|
-
customMarkersRange?: CustomMarkersRange | null;
|
|
101
|
-
customMarkersUrl?: string | null;
|
|
102
|
-
radius: number;
|
|
103
|
-
radiusRange?: number[];
|
|
104
|
-
sizeAggregation?: any;
|
|
105
|
-
sizeRange?: any;
|
|
106
|
-
strokeColorAggregation?: any;
|
|
107
|
-
strokeOpacity?: number;
|
|
108
|
-
strokeColorRange?: ColorRange;
|
|
109
|
-
heightRange?: any;
|
|
110
|
-
heightAggregation?: any;
|
|
111
|
-
weightAggregation?: any;
|
|
112
|
-
};
|
|
113
|
-
export type TextLabel = {
|
|
114
|
-
field: VisualChannelField | null | undefined;
|
|
115
|
-
alignment?: 'center' | 'bottom' | 'top';
|
|
116
|
-
anchor?: 'middle' | 'start' | 'end';
|
|
117
|
-
size: number;
|
|
118
|
-
color?: number[];
|
|
119
|
-
offset?: [number, number];
|
|
120
|
-
outlineColor?: number[];
|
|
121
|
-
};
|
|
122
|
-
export type MapLayerConfig = {
|
|
123
|
-
columns?: Record<string, any>;
|
|
124
|
-
color?: number[];
|
|
125
|
-
label?: string;
|
|
126
|
-
dataId: string;
|
|
127
|
-
textLabel: TextLabel[];
|
|
128
|
-
visConfig: VisConfig;
|
|
129
|
-
};
|
|
130
|
-
export type MapTextSubLayerConfig = Omit<MapLayerConfig, 'textLabel'> & {
|
|
131
|
-
textLabel?: TextLabel;
|
|
132
|
-
};
|
|
133
|
-
export type MapConfigLayer = {
|
|
134
|
-
type: string;
|
|
135
|
-
id: string;
|
|
136
|
-
config: MapLayerConfig;
|
|
137
|
-
visualChannels: VisualChannels;
|
|
138
|
-
};
|
|
139
|
-
export type MapDataset = {
|
|
140
|
-
id: string;
|
|
141
|
-
data: any;
|
|
142
|
-
aggregationExp: string | null;
|
|
143
|
-
aggregationResLevel: number | null;
|
|
144
|
-
geoColumn: string;
|
|
145
|
-
};
|
|
146
|
-
export interface CustomStyle {
|
|
147
|
-
url?: string;
|
|
148
|
-
style?: any;
|
|
149
|
-
customAttribution?: string;
|
|
150
|
-
}
|
|
151
|
-
export type KeplerMapConfig = {
|
|
152
|
-
mapState: any;
|
|
153
|
-
mapStyle: {
|
|
154
|
-
styleType: string;
|
|
155
|
-
visibleLayerGroups: Record<string, boolean>;
|
|
156
|
-
};
|
|
157
|
-
visState: {
|
|
158
|
-
layers: MapConfigLayer[];
|
|
159
|
-
};
|
|
160
|
-
layerBlending: any;
|
|
161
|
-
interactionConfig: any;
|
|
162
|
-
customBaseMaps?: {
|
|
163
|
-
customStyle?: CustomStyle;
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
export type BasemapType = 'maplibre' | 'google-maps';
|
|
167
|
-
export type Basemap = MapLibreBasemap | GoogleBasemap;
|
|
168
|
-
export type BasemapCommon = {
|
|
169
|
-
/**
|
|
170
|
-
* Type of basemap.
|
|
171
|
-
*/
|
|
172
|
-
type: BasemapType;
|
|
173
|
-
/**
|
|
174
|
-
* Custom attribution for style data if not provided by style definition.
|
|
175
|
-
*/
|
|
176
|
-
attribution?: string;
|
|
177
|
-
/**
|
|
178
|
-
* Properties of the basemap. These properties are specific to the basemap type.
|
|
179
|
-
*/
|
|
180
|
-
props: Record<string, any>;
|
|
181
|
-
};
|
|
182
|
-
export type MapLibreBasemap = BasemapCommon & {
|
|
183
|
-
type: 'maplibre';
|
|
184
|
-
/**
|
|
185
|
-
* MapLibre map properties.
|
|
186
|
-
*
|
|
187
|
-
* Meant to be passed to directly to `maplibregl.Map` object.
|
|
188
|
-
*/
|
|
189
|
-
props: MapLibreBasemapProps;
|
|
190
|
-
/**
|
|
191
|
-
* Layer groups to be displayed in the basemap.
|
|
192
|
-
*/
|
|
193
|
-
visibleLayerGroups?: Record<string, boolean>;
|
|
194
|
-
/**
|
|
195
|
-
* If `style` has been filtered by `visibleLayerGroups` then this property contains original style object, so user
|
|
196
|
-
* can use `applyLayerGroupFilters` again with new settings.
|
|
197
|
-
*/
|
|
198
|
-
rawStyle?: string | Record<string, any>;
|
|
199
|
-
};
|
|
200
|
-
export type MapLibreBasemapProps = {
|
|
201
|
-
style: string | Record<string, any>;
|
|
202
|
-
center: [number, number];
|
|
203
|
-
zoom: number;
|
|
204
|
-
pitch?: number;
|
|
205
|
-
bearing?: number;
|
|
206
|
-
};
|
|
207
|
-
export type GoogleBasemap = BasemapCommon & {
|
|
208
|
-
type: 'google-maps';
|
|
209
|
-
/**
|
|
210
|
-
* Google map properties.
|
|
211
|
-
*
|
|
212
|
-
* Meant to be passed to directly to `google.maps.Map` object.
|
|
213
|
-
*/
|
|
214
|
-
props: GoogleBasemapProps;
|
|
215
|
-
};
|
|
216
|
-
export type GoogleBasemapProps = {
|
|
217
|
-
mapTypeId: string;
|
|
218
|
-
mapId?: string;
|
|
219
|
-
center?: {
|
|
220
|
-
lat: number;
|
|
221
|
-
lng: number;
|
|
222
|
-
};
|
|
223
|
-
zoom?: number;
|
|
224
|
-
tilt?: number;
|
|
225
|
-
heading?: number;
|
|
226
|
-
};
|
|
227
|
-
export {};
|
package/src/api/types.ts
DELETED
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
// deck.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
5
|
-
export type Format = 'json' | 'geojson' | 'tilejson';
|
|
6
|
-
export type MapType = 'boundary' | 'query' | 'table' | 'tileset' | 'raster';
|
|
7
|
-
export type RequestType =
|
|
8
|
-
| 'Map data'
|
|
9
|
-
| 'Map instantiation'
|
|
10
|
-
| 'Public map'
|
|
11
|
-
| 'Tile stats'
|
|
12
|
-
| 'SQL'
|
|
13
|
-
| 'Basemap style';
|
|
14
|
-
export type ScaleType =
|
|
15
|
-
| 'linear'
|
|
16
|
-
| 'ordinal'
|
|
17
|
-
| 'log'
|
|
18
|
-
| 'point'
|
|
19
|
-
| 'quantile'
|
|
20
|
-
| 'quantize'
|
|
21
|
-
| 'sqrt'
|
|
22
|
-
| 'custom'
|
|
23
|
-
| 'identity';
|
|
24
|
-
|
|
25
|
-
export type APIErrorContext = {
|
|
26
|
-
requestType: RequestType;
|
|
27
|
-
mapId?: string;
|
|
28
|
-
connection?: string;
|
|
29
|
-
source?: string;
|
|
30
|
-
type?: MapType;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export enum SchemaFieldType {
|
|
34
|
-
Number = 'number',
|
|
35
|
-
Bigint = 'bigint',
|
|
36
|
-
String = 'string',
|
|
37
|
-
Geometry = 'geometry',
|
|
38
|
-
Timestamp = 'timestamp',
|
|
39
|
-
Object = 'object',
|
|
40
|
-
Boolean = 'boolean',
|
|
41
|
-
Variant = 'variant',
|
|
42
|
-
Unknown = 'unknown',
|
|
43
|
-
}
|
|
44
|
-
export interface SchemaField {
|
|
45
|
-
name: string;
|
|
46
|
-
type: SchemaFieldType; // Field type in the CARTO stack, common for all providers
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface MapInstantiation extends MapInstantiationFormats {
|
|
50
|
-
nrows: number;
|
|
51
|
-
size?: number;
|
|
52
|
-
schema: SchemaField[];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
type MapInstantiationFormats = Record<
|
|
56
|
-
Format,
|
|
57
|
-
{
|
|
58
|
-
url: string[];
|
|
59
|
-
error?: any;
|
|
60
|
-
}
|
|
61
|
-
>;
|
|
62
|
-
|
|
63
|
-
export type QueryParameterValue =
|
|
64
|
-
| string
|
|
65
|
-
| number
|
|
66
|
-
| boolean
|
|
67
|
-
| Array<QueryParameterValue>
|
|
68
|
-
| object;
|
|
69
|
-
|
|
70
|
-
export type NamedQueryParameter = Record<string, QueryParameterValue>;
|
|
71
|
-
|
|
72
|
-
export type PositionalQueryParameter = QueryParameterValue[];
|
|
73
|
-
|
|
74
|
-
export type QueryParameters = NamedQueryParameter | PositionalQueryParameter;
|
|
75
|
-
export type VisualChannelField = {
|
|
76
|
-
name: string;
|
|
77
|
-
type: string;
|
|
78
|
-
colorColumn?: string;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export interface Filters {
|
|
82
|
-
[column: string]: Filter;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
interface Filter {
|
|
86
|
-
[FilterTypes.In]?: number[];
|
|
87
|
-
[FilterTypes.Between]?: number[][];
|
|
88
|
-
[FilterTypes.ClosedOpen]?: number[][];
|
|
89
|
-
[FilterTypes.Time]?: number[][];
|
|
90
|
-
[FilterTypes.StringSearch]?: string[];
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export enum FilterTypes {
|
|
94
|
-
In = 'in',
|
|
95
|
-
Between = 'between', // [a, b] both are included
|
|
96
|
-
ClosedOpen = 'closed_open', // [a, b) a is included, b is not
|
|
97
|
-
Time = 'time',
|
|
98
|
-
StringSearch = 'stringSearch',
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export type VisualChannels = {
|
|
102
|
-
colorField?: VisualChannelField;
|
|
103
|
-
colorScale?: ScaleType;
|
|
104
|
-
|
|
105
|
-
customMarkersField?: VisualChannelField;
|
|
106
|
-
customMarkersScale?: ScaleType;
|
|
107
|
-
|
|
108
|
-
radiusField?: VisualChannelField;
|
|
109
|
-
radiusScale?: ScaleType;
|
|
110
|
-
|
|
111
|
-
rotationScale?: ScaleType;
|
|
112
|
-
rotationField?: VisualChannelField;
|
|
113
|
-
|
|
114
|
-
sizeField?: VisualChannelField;
|
|
115
|
-
sizeScale?: ScaleType;
|
|
116
|
-
|
|
117
|
-
strokeColorField?: VisualChannelField;
|
|
118
|
-
strokeColorScale?: ScaleType;
|
|
119
|
-
|
|
120
|
-
heightField?: VisualChannelField;
|
|
121
|
-
heightScale?: ScaleType;
|
|
122
|
-
|
|
123
|
-
weightField?: VisualChannelField;
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
export type ColorRange = {
|
|
127
|
-
category: string;
|
|
128
|
-
colors: string[];
|
|
129
|
-
colorMap: string[][] | undefined;
|
|
130
|
-
name: string;
|
|
131
|
-
type: string;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
export type CustomMarkersRange = {
|
|
135
|
-
markerMap: {
|
|
136
|
-
value: string;
|
|
137
|
-
markerUrl?: string;
|
|
138
|
-
}[];
|
|
139
|
-
othersMarker?: string;
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
export type VisConfig = {
|
|
143
|
-
filled?: boolean;
|
|
144
|
-
opacity?: number;
|
|
145
|
-
enable3d?: boolean;
|
|
146
|
-
|
|
147
|
-
colorAggregation?: any;
|
|
148
|
-
colorRange: ColorRange;
|
|
149
|
-
|
|
150
|
-
customMarkers?: boolean;
|
|
151
|
-
customMarkersRange?: CustomMarkersRange | null;
|
|
152
|
-
customMarkersUrl?: string | null;
|
|
153
|
-
|
|
154
|
-
radius: number;
|
|
155
|
-
radiusRange?: number[];
|
|
156
|
-
|
|
157
|
-
sizeAggregation?: any;
|
|
158
|
-
sizeRange?: any;
|
|
159
|
-
|
|
160
|
-
strokeColorAggregation?: any;
|
|
161
|
-
strokeOpacity?: number;
|
|
162
|
-
strokeColorRange?: ColorRange;
|
|
163
|
-
|
|
164
|
-
heightRange?: any;
|
|
165
|
-
heightAggregation?: any;
|
|
166
|
-
|
|
167
|
-
weightAggregation?: any;
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
export type TextLabel = {
|
|
171
|
-
field: VisualChannelField | null | undefined;
|
|
172
|
-
alignment?: 'center' | 'bottom' | 'top';
|
|
173
|
-
anchor?: 'middle' | 'start' | 'end';
|
|
174
|
-
size: number;
|
|
175
|
-
color?: number[];
|
|
176
|
-
offset?: [number, number];
|
|
177
|
-
outlineColor?: number[];
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
export type MapLayerConfig = {
|
|
181
|
-
columns?: Record<string, any>;
|
|
182
|
-
color?: number[];
|
|
183
|
-
label?: string;
|
|
184
|
-
dataId: string;
|
|
185
|
-
textLabel: TextLabel[];
|
|
186
|
-
visConfig: VisConfig;
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
export type MapTextSubLayerConfig = Omit<MapLayerConfig, 'textLabel'> & {
|
|
190
|
-
textLabel?: TextLabel;
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
export type MapConfigLayer = {
|
|
194
|
-
type: string;
|
|
195
|
-
id: string;
|
|
196
|
-
config: MapLayerConfig;
|
|
197
|
-
visualChannels: VisualChannels;
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
export type MapDataset = {
|
|
201
|
-
id: string;
|
|
202
|
-
data: any;
|
|
203
|
-
aggregationExp: string | null;
|
|
204
|
-
aggregationResLevel: number | null;
|
|
205
|
-
geoColumn: string;
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
export interface CustomStyle {
|
|
209
|
-
url?: string;
|
|
210
|
-
style?: any;
|
|
211
|
-
customAttribution?: string;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
export type KeplerMapConfig = {
|
|
215
|
-
mapState: any;
|
|
216
|
-
mapStyle: {
|
|
217
|
-
styleType: string;
|
|
218
|
-
visibleLayerGroups: Record<string, boolean>;
|
|
219
|
-
};
|
|
220
|
-
visState: {
|
|
221
|
-
layers: MapConfigLayer[];
|
|
222
|
-
};
|
|
223
|
-
layerBlending: any;
|
|
224
|
-
interactionConfig: any;
|
|
225
|
-
customBaseMaps?: {
|
|
226
|
-
customStyle?: CustomStyle;
|
|
227
|
-
};
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
export type BasemapType = 'maplibre' | 'google-maps';
|
|
231
|
-
|
|
232
|
-
export type Basemap = MapLibreBasemap | GoogleBasemap;
|
|
233
|
-
|
|
234
|
-
export type BasemapCommon = {
|
|
235
|
-
/**
|
|
236
|
-
* Type of basemap.
|
|
237
|
-
*/
|
|
238
|
-
type: BasemapType;
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Custom attribution for style data if not provided by style definition.
|
|
242
|
-
*/
|
|
243
|
-
attribution?: string;
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Properties of the basemap. These properties are specific to the basemap type.
|
|
247
|
-
*/
|
|
248
|
-
props: Record<string, any>;
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
export type MapLibreBasemap = BasemapCommon & {
|
|
252
|
-
type: 'maplibre';
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* MapLibre map properties.
|
|
256
|
-
*
|
|
257
|
-
* Meant to be passed to directly to `maplibregl.Map` object.
|
|
258
|
-
*/
|
|
259
|
-
props: MapLibreBasemapProps;
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* Layer groups to be displayed in the basemap.
|
|
263
|
-
*/
|
|
264
|
-
visibleLayerGroups?: Record<string, boolean>;
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* If `style` has been filtered by `visibleLayerGroups` then this property contains original style object, so user
|
|
268
|
-
* can use `applyLayerGroupFilters` again with new settings.
|
|
269
|
-
*/
|
|
270
|
-
rawStyle?: string | Record<string, any>;
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
// Cherry-pick of maplibregl Map API props that are supported/provided by fetchMap interface
|
|
274
|
-
export type MapLibreBasemapProps = {
|
|
275
|
-
style: string | Record<string, any>;
|
|
276
|
-
center: [number, number];
|
|
277
|
-
zoom: number;
|
|
278
|
-
pitch?: number;
|
|
279
|
-
bearing?: number;
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
export type GoogleBasemap = BasemapCommon & {
|
|
283
|
-
type: 'google-maps';
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Google map properties.
|
|
287
|
-
*
|
|
288
|
-
* Meant to be passed to directly to `google.maps.Map` object.
|
|
289
|
-
*/
|
|
290
|
-
props: GoogleBasemapProps;
|
|
291
|
-
};
|
|
292
|
-
|
|
293
|
-
// Cherry-pick of Google Map API props that are supported/provided by fetchMap interface
|
|
294
|
-
export type GoogleBasemapProps = {
|
|
295
|
-
mapTypeId: string;
|
|
296
|
-
mapId?: string;
|
|
297
|
-
center?: {lat: number; lng: number};
|
|
298
|
-
zoom?: number;
|
|
299
|
-
tilt?: number;
|
|
300
|
-
heading?: number;
|
|
301
|
-
};
|