@carto/api-client 0.4.0-alpha.0 → 0.4.0-alpha.3
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 +293 -158
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.modern.js +243 -126
- 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/h3-query-source.d.ts +2 -1
- package/build/sources/h3-table-source.d.ts +2 -1
- package/build/sources/index.d.ts +1 -1
- package/build/sources/quadbin-query-source.d.ts +2 -1
- package/build/sources/quadbin-table-source.d.ts +2 -1
- package/build/sources/types.d.ts +2 -1
- package/build/sources/vector-query-source.d.ts +2 -1
- package/build/sources/vector-table-source.d.ts +2 -1
- package/build/types-internal.d.ts +46 -1
- package/build/types.d.ts +11 -0
- package/build/widget-sources/index.d.ts +0 -1
- package/build/widget-sources/widget-base-source.d.ts +1 -1
- package/build/widget-sources/widget-query-source.d.ts +3 -0
- package/build/widget-sources/widget-table-source.d.ts +3 -0
- package/package.json +2 -2
- 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 +4 -8
- package/src/constants-internal.ts +9 -30
- package/src/constants.ts +32 -16
- package/src/index.ts +43 -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 +9 -7
- package/src/sources/h3-table-source.ts +9 -7
- package/src/sources/index.ts +6 -1
- package/src/sources/quadbin-query-source.ts +9 -7
- package/src/sources/quadbin-table-source.ts +9 -7
- package/src/sources/types.ts +2 -6
- package/src/sources/vector-query-source.ts +12 -7
- package/src/sources/vector-table-source.ts +12 -7
- package/src/types-internal.ts +54 -1
- package/src/types.ts +16 -0
- package/src/widget-sources/index.ts +0 -1
- package/src/widget-sources/widget-base-source.ts +5 -5
- package/src/widget-sources/widget-query-source.ts +3 -2
- package/src/widget-sources/widget-table-source.ts +3 -2
- package/build/api/types.d.ts +0 -227
- package/build/widget-sources/wrappers.d.ts +0 -48
- package/src/api/types.ts +0 -301
- package/src/widget-sources/wrappers.ts +0 -121
package/src/sources/index.ts
CHANGED
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
export {SOURCE_DEFAULTS} from './base-source';
|
|
6
|
-
export type {
|
|
6
|
+
export type {
|
|
7
|
+
TilejsonResult,
|
|
8
|
+
GeojsonResult,
|
|
9
|
+
JsonResult,
|
|
10
|
+
QueryResult,
|
|
11
|
+
} from './types';
|
|
7
12
|
|
|
8
13
|
export {boundaryQuerySource} from './boundary-query-source';
|
|
9
14
|
export type {BoundaryQuerySourceOptions} from './boundary-query-source';
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
/* eslint-disable camelcase */
|
|
6
|
-
import {DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN} from '../constants';
|
|
6
|
+
import {DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN} from '../constants-internal';
|
|
7
|
+
import {WidgetQuerySource, WidgetQuerySourceResult} from '../widget-sources';
|
|
7
8
|
import {baseSource} from './base-source';
|
|
8
9
|
import type {
|
|
9
10
|
AggregationOptions,
|
|
@@ -31,7 +32,7 @@ type UrlParameters = {
|
|
|
31
32
|
|
|
32
33
|
export const quadbinQuerySource = async function (
|
|
33
34
|
options: QuadbinQuerySourceOptions
|
|
34
|
-
): Promise<TilejsonResult> {
|
|
35
|
+
): Promise<TilejsonResult & WidgetQuerySourceResult> {
|
|
35
36
|
const {
|
|
36
37
|
aggregationExp,
|
|
37
38
|
aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN,
|
|
@@ -56,9 +57,10 @@ export const quadbinQuerySource = async function (
|
|
|
56
57
|
if (filters) {
|
|
57
58
|
urlParameters.filters = filters;
|
|
58
59
|
}
|
|
59
|
-
return baseSource<UrlParameters>(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
return baseSource<UrlParameters>('query', options, urlParameters).then(
|
|
61
|
+
(result) => ({
|
|
62
|
+
...(result as TilejsonResult),
|
|
63
|
+
widgetSource: new WidgetQuerySource(options),
|
|
64
|
+
})
|
|
65
|
+
);
|
|
64
66
|
};
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
/* eslint-disable camelcase */
|
|
6
|
-
import {DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN} from '../constants';
|
|
6
|
+
import {DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN} from '../constants-internal';
|
|
7
|
+
import {WidgetTableSource, WidgetTableSourceResult} from '../widget-sources';
|
|
7
8
|
import {baseSource} from './base-source';
|
|
8
9
|
import type {
|
|
9
10
|
AggregationOptions,
|
|
@@ -30,7 +31,7 @@ type UrlParameters = {
|
|
|
30
31
|
|
|
31
32
|
export const quadbinTableSource = async function (
|
|
32
33
|
options: QuadbinTableSourceOptions
|
|
33
|
-
): Promise<TilejsonResult> {
|
|
34
|
+
): Promise<TilejsonResult & WidgetTableSourceResult> {
|
|
34
35
|
const {
|
|
35
36
|
aggregationExp,
|
|
36
37
|
aggregationResLevel = DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN,
|
|
@@ -52,9 +53,10 @@ export const quadbinTableSource = async function (
|
|
|
52
53
|
if (filters) {
|
|
53
54
|
urlParameters.filters = filters;
|
|
54
55
|
}
|
|
55
|
-
return baseSource<UrlParameters>(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
return baseSource<UrlParameters>('table', options, urlParameters).then(
|
|
57
|
+
(result) => ({
|
|
58
|
+
...(result as TilejsonResult),
|
|
59
|
+
widgetSource: new WidgetTableSource(options),
|
|
60
|
+
})
|
|
61
|
+
);
|
|
60
62
|
};
|
package/src/sources/types.ts
CHANGED
|
@@ -3,12 +3,8 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import type {Feature} from 'geojson';
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
Format,
|
|
9
|
-
MapInstantiation,
|
|
10
|
-
QueryParameters,
|
|
11
|
-
} from '../api/types';
|
|
6
|
+
import {Filters, Format, QueryParameters} from '../types';
|
|
7
|
+
import {MapInstantiation} from '../types-internal';
|
|
12
8
|
|
|
13
9
|
export type SourceRequiredOptions = {
|
|
14
10
|
/** Carto platform access token. */
|
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
/* eslint-disable camelcase */
|
|
6
|
-
import {DEFAULT_TILE_RESOLUTION} from '../constants';
|
|
6
|
+
import {DEFAULT_TILE_RESOLUTION} from '../constants.js';
|
|
7
|
+
import {
|
|
8
|
+
WidgetQuerySource,
|
|
9
|
+
WidgetQuerySourceResult,
|
|
10
|
+
} from '../widget-sources/index.js';
|
|
7
11
|
import {baseSource} from './base-source';
|
|
8
12
|
import type {
|
|
9
13
|
FilterOptions,
|
|
@@ -31,7 +35,7 @@ type UrlParameters = {
|
|
|
31
35
|
|
|
32
36
|
export const vectorQuerySource = async function (
|
|
33
37
|
options: VectorQuerySourceOptions
|
|
34
|
-
): Promise<TilejsonResult> {
|
|
38
|
+
): Promise<TilejsonResult & WidgetQuerySourceResult> {
|
|
35
39
|
const {
|
|
36
40
|
columns,
|
|
37
41
|
filters,
|
|
@@ -57,9 +61,10 @@ export const vectorQuerySource = async function (
|
|
|
57
61
|
if (queryParameters) {
|
|
58
62
|
urlParameters.queryParameters = queryParameters;
|
|
59
63
|
}
|
|
60
|
-
return baseSource<UrlParameters>(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
return baseSource<UrlParameters>('query', options, urlParameters).then(
|
|
65
|
+
(result) => ({
|
|
66
|
+
...(result as TilejsonResult),
|
|
67
|
+
widgetSource: new WidgetQuerySource(options),
|
|
68
|
+
})
|
|
69
|
+
);
|
|
65
70
|
};
|
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
/* eslint-disable camelcase */
|
|
6
|
-
import {DEFAULT_TILE_RESOLUTION} from '../constants';
|
|
6
|
+
import {DEFAULT_TILE_RESOLUTION} from '../constants.js';
|
|
7
|
+
import {
|
|
8
|
+
WidgetTableSource,
|
|
9
|
+
WidgetTableSourceResult,
|
|
10
|
+
} from '../widget-sources/index.js';
|
|
7
11
|
import {baseSource} from './base-source';
|
|
8
12
|
import type {
|
|
9
13
|
FilterOptions,
|
|
@@ -29,7 +33,7 @@ type UrlParameters = {
|
|
|
29
33
|
|
|
30
34
|
export const vectorTableSource = async function (
|
|
31
35
|
options: VectorTableSourceOptions
|
|
32
|
-
): Promise<TilejsonResult> {
|
|
36
|
+
): Promise<TilejsonResult & WidgetTableSourceResult> {
|
|
33
37
|
const {
|
|
34
38
|
columns,
|
|
35
39
|
filters,
|
|
@@ -51,9 +55,10 @@ export const vectorTableSource = async function (
|
|
|
51
55
|
if (filters) {
|
|
52
56
|
urlParameters.filters = filters;
|
|
53
57
|
}
|
|
54
|
-
return baseSource<UrlParameters>(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
return baseSource<UrlParameters>('table', options, urlParameters).then(
|
|
59
|
+
(result) => ({
|
|
60
|
+
...(result as TilejsonResult),
|
|
61
|
+
widgetSource: new WidgetTableSource(options),
|
|
62
|
+
})
|
|
63
|
+
);
|
|
59
64
|
};
|
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
|
|
|
@@ -12,6 +11,8 @@ type LayerQuerySourceOptions =
|
|
|
12
11
|
| Omit<H3QuerySourceOptions, 'filters'>
|
|
13
12
|
| Omit<QuadbinQuerySourceOptions, 'filters'>;
|
|
14
13
|
|
|
14
|
+
export type WidgetQuerySourceResult = {widgetSource: WidgetQuerySource};
|
|
15
|
+
|
|
15
16
|
/**
|
|
16
17
|
* Source for Widget API requests on a data source defined by a SQL query.
|
|
17
18
|
*
|
|
@@ -40,7 +41,7 @@ export class WidgetQuerySource extends WidgetBaseSource<
|
|
|
40
41
|
protected override getModelSource(owner: string): ModelSource {
|
|
41
42
|
return {
|
|
42
43
|
...super._getModelSource(owner),
|
|
43
|
-
type:
|
|
44
|
+
type: 'query',
|
|
44
45
|
data: this.props.sqlQuery,
|
|
45
46
|
queryParameters: this.props.queryParameters,
|
|
46
47
|
};
|
|
@@ -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 =
|
|
@@ -12,6 +11,8 @@ type LayerTableSourceOptions =
|
|
|
12
11
|
| Omit<H3TableSourceOptions, 'filters'>
|
|
13
12
|
| Omit<QuadbinTableSourceOptions, 'filters'>;
|
|
14
13
|
|
|
14
|
+
export type WidgetTableSourceResult = {widgetSource: WidgetTableSource};
|
|
15
|
+
|
|
15
16
|
/**
|
|
16
17
|
* Source for Widget API requests on a data source defined as a table.
|
|
17
18
|
*
|
|
@@ -40,7 +41,7 @@ export class WidgetTableSource extends WidgetBaseSource<
|
|
|
40
41
|
protected override getModelSource(owner: string): ModelSource {
|
|
41
42
|
return {
|
|
42
43
|
...super._getModelSource(owner),
|
|
43
|
-
type:
|
|
44
|
+
type: 'table',
|
|
44
45
|
data: this.props.tableName,
|
|
45
46
|
};
|
|
46
47
|
}
|
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 {};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { h3TableSource as _h3TableSource, h3QuerySource as _h3QuerySource, vectorTableSource as _vectorTableSource, vectorQuerySource as _vectorQuerySource, quadbinTableSource as _quadbinTableSource, quadbinQuerySource as _quadbinQuerySource, VectorTableSourceOptions as _VectorTableSourceOptions, VectorQuerySourceOptions as _VectorQuerySourceOptions, H3TableSourceOptions as _H3TableSourceOptions, H3QuerySourceOptions as _H3QuerySourceOptions, QuadbinTableSourceOptions as _QuadbinTableSourceOptions, QuadbinQuerySourceOptions as _QuadbinQuerySourceOptions } from '../sources/index.js';
|
|
2
|
-
import { WidgetBaseSourceProps } from './widget-base-source.js';
|
|
3
|
-
import { WidgetQuerySource } from './widget-query-source.js';
|
|
4
|
-
import { WidgetTableSource } from './widget-table-source.js';
|
|
5
|
-
type WrappedSourceOptions<T> = Omit<T, 'filters'> & WidgetBaseSourceProps;
|
|
6
|
-
/******************************************************************************
|
|
7
|
-
* RESPONSE OBJECTS
|
|
8
|
-
*/
|
|
9
|
-
type WidgetTableSourceResponse = {
|
|
10
|
-
widgetSource: WidgetTableSource;
|
|
11
|
-
};
|
|
12
|
-
type WidgetQuerySourceResponse = {
|
|
13
|
-
widgetSource: WidgetQuerySource;
|
|
14
|
-
};
|
|
15
|
-
export type VectorTableSourceResponse = WidgetTableSourceResponse & Awaited<ReturnType<typeof _vectorTableSource>>;
|
|
16
|
-
export type VectorQuerySourceResponse = WidgetQuerySourceResponse & Awaited<ReturnType<typeof _vectorQuerySource>>;
|
|
17
|
-
export type H3TableSourceResponse = WidgetTableSourceResponse & Awaited<ReturnType<typeof _h3TableSource>>;
|
|
18
|
-
export type H3QuerySourceResponse = WidgetQuerySourceResponse & Awaited<ReturnType<typeof _h3QuerySource>>;
|
|
19
|
-
export type QuadbinTableSourceResponse = WidgetTableSourceResponse & Awaited<ReturnType<typeof _quadbinTableSource>>;
|
|
20
|
-
export type QuadbinQuerySourceResponse = WidgetQuerySourceResponse & Awaited<ReturnType<typeof _quadbinQuerySource>>;
|
|
21
|
-
/******************************************************************************
|
|
22
|
-
* VECTOR SOURCES
|
|
23
|
-
*/
|
|
24
|
-
export type VectorTableSourceOptions = WrappedSourceOptions<_VectorTableSourceOptions>;
|
|
25
|
-
export type VectorQuerySourceOptions = WrappedSourceOptions<_VectorQuerySourceOptions>;
|
|
26
|
-
/** Wrapper adding Widget API support to [vectorTableSource](https://deck.gl/docs/api-reference/carto/data-sources). */
|
|
27
|
-
export declare function vectorTableSource(props: VectorTableSourceOptions): Promise<VectorTableSourceResponse>;
|
|
28
|
-
/** Wrapper adding Widget API support to [vectorQuerySource](https://deck.gl/docs/api-reference/carto/data-sources). */
|
|
29
|
-
export declare function vectorQuerySource(props: VectorQuerySourceOptions): Promise<VectorQuerySourceResponse>;
|
|
30
|
-
/******************************************************************************
|
|
31
|
-
* H3 SOURCES
|
|
32
|
-
*/
|
|
33
|
-
export type H3TableSourceOptions = WrappedSourceOptions<_H3TableSourceOptions>;
|
|
34
|
-
export type H3QuerySourceOptions = WrappedSourceOptions<_H3QuerySourceOptions>;
|
|
35
|
-
/** Wrapper adding Widget API support to [h3TableSource](https://deck.gl/docs/api-reference/carto/data-sources). */
|
|
36
|
-
export declare function h3TableSource(props: H3TableSourceOptions): Promise<H3TableSourceResponse>;
|
|
37
|
-
/** Wrapper adding Widget API support to [h3QuerySource](https://deck.gl/docs/api-reference/carto/data-sources). */
|
|
38
|
-
export declare function h3QuerySource(props: H3QuerySourceOptions): Promise<H3QuerySourceResponse>;
|
|
39
|
-
/******************************************************************************
|
|
40
|
-
* QUADBIN SOURCES
|
|
41
|
-
*/
|
|
42
|
-
export type QuadbinTableSourceOptions = WrappedSourceOptions<_QuadbinTableSourceOptions>;
|
|
43
|
-
export type QuadbinQuerySourceOptions = WrappedSourceOptions<_QuadbinQuerySourceOptions>;
|
|
44
|
-
/** Wrapper adding Widget API support to [quadbinTableSource](https://deck.gl/docs/api-reference/carto/data-sources). */
|
|
45
|
-
export declare function quadbinTableSource(props: QuadbinTableSourceOptions & WidgetBaseSourceProps): Promise<QuadbinTableSourceResponse>;
|
|
46
|
-
/** Wrapper adding Widget API support to [quadbinQuerySource](https://deck.gl/docs/api-reference/carto/data-sources). */
|
|
47
|
-
export declare function quadbinQuerySource(props: QuadbinQuerySourceOptions & WidgetBaseSourceProps): Promise<QuadbinQuerySourceResponse>;
|
|
48
|
-
export {};
|