@carto/api-client 0.5.0-alpha.2 → 0.5.0-alpha.4
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 +4 -0
- package/build/api/carto-api-error.d.ts +1 -1
- package/build/api/query.d.ts +1 -1
- package/build/api/request-with-parameters.d.ts +2 -2
- package/build/api-client.cjs +2380 -2508
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.modern.js +2220 -2349
- package/build/api-client.modern.js.map +1 -1
- package/build/client.d.ts +2 -2
- package/build/constants-internal.d.ts +5 -5
- package/build/constants.d.ts +6 -6
- package/build/deck/get-data-filter-extension-props.d.ts +18 -0
- package/build/deck/index.d.ts +1 -0
- package/build/filters/Filter.d.ts +15 -3
- package/build/filters/FilterTypes.d.ts +1 -1
- package/build/filters/geosjonFeatures.d.ts +2 -2
- package/build/filters/tileFeatures.d.ts +10 -9
- package/build/filters/tileFeaturesRaster.d.ts +16 -0
- package/build/filters.d.ts +2 -2
- package/build/geo.d.ts +1 -1
- package/build/index.d.ts +2 -0
- package/build/models/common.d.ts +4 -3
- package/build/models/model.d.ts +2 -2
- package/build/operations/aggregation.d.ts +5 -5
- package/build/operations/applySorting.d.ts +3 -3
- package/build/operations/groupBy.d.ts +4 -4
- package/build/operations/groupByDate.d.ts +1 -1
- package/build/operations/histogram.d.ts +3 -3
- package/build/operations/scatterPlot.d.ts +3 -3
- package/build/sources/base-source.d.ts +2 -2
- package/build/sources/boundary-query-source.d.ts +1 -1
- package/build/sources/boundary-table-source.d.ts +1 -1
- package/build/sources/h3-query-source.d.ts +2 -2
- package/build/sources/h3-table-source.d.ts +2 -2
- package/build/sources/h3-tileset-source.d.ts +2 -2
- package/build/sources/index.d.ts +26 -26
- package/build/sources/quadbin-query-source.d.ts +2 -2
- package/build/sources/quadbin-table-source.d.ts +2 -2
- package/build/sources/quadbin-tileset-source.d.ts +2 -2
- package/build/sources/raster-source.d.ts +3 -2
- package/build/sources/types.d.ts +4 -4
- package/build/sources/vector-query-source.d.ts +1 -1
- package/build/sources/vector-table-source.d.ts +1 -1
- package/build/sources/vector-tileset-source.d.ts +2 -2
- package/build/spatial-index.d.ts +10 -4
- package/build/types-internal.d.ts +5 -5
- package/build/types.d.ts +23 -15
- package/build/utils/makeIntervalComplete.d.ts +1 -1
- package/build/utils.d.ts +3 -3
- package/build/widget-sources/index.d.ts +1 -0
- package/build/widget-sources/types.d.ts +4 -2
- package/build/widget-sources/widget-query-source.d.ts +2 -1
- package/build/widget-sources/widget-raster-source.d.ts +11 -0
- package/build/widget-sources/widget-remote-source.d.ts +3 -0
- package/build/widget-sources/widget-source.d.ts +3 -3
- package/build/widget-sources/widget-table-source.d.ts +2 -1
- package/build/widget-sources/widget-tileset-source.d.ts +21 -22
- package/package.json +44 -32
- package/src/api/carto-api-error.ts +1 -1
- package/src/api/query.ts +5 -5
- package/src/api/request-with-parameters.ts +6 -6
- package/src/client.ts +3 -3
- package/src/constants-internal.ts +5 -5
- package/src/constants.ts +6 -6
- package/src/deck/get-data-filter-extension-props.ts +146 -0
- package/src/deck/index.ts +1 -0
- package/src/filters/Filter.ts +18 -8
- package/src/filters/FilterTypes.ts +2 -2
- package/src/filters/geosjonFeatures.ts +2 -2
- package/src/filters/tileFeatures.ts +33 -23
- package/src/filters/tileFeaturesRaster.ts +111 -0
- package/src/filters.ts +4 -4
- package/src/geo.ts +12 -14
- package/src/index.ts +3 -0
- package/src/models/common.ts +9 -7
- package/src/models/model.ts +3 -4
- package/src/operations/aggregation.ts +5 -5
- package/src/operations/applySorting.ts +4 -4
- package/src/operations/groupBy.ts +4 -4
- package/src/operations/groupByDate.ts +1 -1
- package/src/operations/histogram.ts +4 -4
- package/src/operations/scatterPlot.ts +4 -4
- package/src/sources/base-source.ts +8 -8
- package/src/sources/boundary-query-source.ts +2 -2
- package/src/sources/boundary-table-source.ts +2 -2
- package/src/sources/h3-query-source.ts +7 -5
- package/src/sources/h3-table-source.ts +7 -5
- package/src/sources/h3-tileset-source.ts +4 -4
- package/src/sources/index.ts +26 -26
- package/src/sources/quadbin-query-source.ts +7 -5
- package/src/sources/quadbin-table-source.ts +7 -5
- package/src/sources/quadbin-tileset-source.ts +4 -4
- package/src/sources/raster-source.ts +20 -7
- package/src/sources/types.ts +4 -4
- package/src/sources/vector-query-source.ts +2 -3
- package/src/sources/vector-table-source.ts +2 -3
- package/src/sources/vector-tileset-source.ts +5 -5
- package/src/spatial-index.ts +12 -10
- package/src/types-internal.ts +5 -5
- package/src/types.ts +21 -15
- package/src/utils/makeIntervalComplete.ts +1 -1
- package/src/utils.ts +3 -3
- package/src/widget-sources/index.ts +1 -0
- package/src/widget-sources/types.ts +5 -3
- package/src/widget-sources/widget-query-source.ts +6 -2
- package/src/widget-sources/widget-raster-source.ts +14 -0
- package/src/widget-sources/widget-remote-source.ts +31 -16
- package/src/widget-sources/widget-source.ts +13 -4
- package/src/widget-sources/widget-table-source.ts +6 -2
- package/src/widget-sources/widget-tileset-source.ts +133 -85
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* COMMON
|
|
3
3
|
*/
|
|
4
|
-
import { Format } from './types';
|
|
4
|
+
import { Format } from './types.js';
|
|
5
5
|
/** @internal */
|
|
6
6
|
export type $TODO = any;
|
|
7
7
|
/** @internal */
|
|
@@ -10,7 +10,7 @@ export type $IntentionalAny = any;
|
|
|
10
10
|
* MAP INSTANTIATION
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
13
|
-
* @
|
|
13
|
+
* @privateRemarks Source: @deck.gl/carto
|
|
14
14
|
* @internal
|
|
15
15
|
*/
|
|
16
16
|
export declare enum SchemaFieldType {
|
|
@@ -25,7 +25,7 @@ export declare enum SchemaFieldType {
|
|
|
25
25
|
Unknown = "unknown"
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
* @
|
|
28
|
+
* @privateRemarks Source: @deck.gl/carto
|
|
29
29
|
* @internal
|
|
30
30
|
*/
|
|
31
31
|
export interface SchemaField {
|
|
@@ -33,7 +33,7 @@ export interface SchemaField {
|
|
|
33
33
|
type: SchemaFieldType;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
* @
|
|
36
|
+
* @privateRemarks Source: @deck.gl/carto
|
|
37
37
|
* @internal
|
|
38
38
|
*/
|
|
39
39
|
export interface MapInstantiation extends MapInstantiationFormats {
|
|
@@ -42,7 +42,7 @@ export interface MapInstantiation extends MapInstantiationFormats {
|
|
|
42
42
|
schema: SchemaField[];
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
* @
|
|
45
|
+
* @privateRemarks Source: @deck.gl/carto
|
|
46
46
|
* @internal
|
|
47
47
|
*/
|
|
48
48
|
type MapInstantiationFormats = Record<Format, {
|
package/build/types.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ import type { BinaryFeature, BinaryFeatureCollection } from '@loaders.gl/schema'
|
|
|
4
4
|
/******************************************************************************
|
|
5
5
|
* MAPS AND TILES
|
|
6
6
|
*/
|
|
7
|
-
/** @
|
|
7
|
+
/** @privateRemarks Source: @deck.gl/carto */
|
|
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
11
|
/**
|
|
12
12
|
* Alias for GeoJSON 'BBox' type, semantically representing a viewport.
|
|
@@ -18,7 +18,7 @@ export type Viewport = [number, number, number, number];
|
|
|
18
18
|
* required for local widget calculations. Deeper dependencies on deck.gl
|
|
19
19
|
* APIs should be minimized within this library: @deck.gl/carto depends
|
|
20
20
|
* on the API client, not the other way around.
|
|
21
|
-
* @
|
|
21
|
+
* @privateRemarks Source: @deck.gl/geo-layers
|
|
22
22
|
*/
|
|
23
23
|
export type Tile = {
|
|
24
24
|
index: {
|
|
@@ -44,7 +44,15 @@ export type SpatialIndexTile = Tile & {
|
|
|
44
44
|
id: bigint;
|
|
45
45
|
})[];
|
|
46
46
|
};
|
|
47
|
-
|
|
47
|
+
export type RasterTile = Tile & {
|
|
48
|
+
id: string;
|
|
49
|
+
index: {
|
|
50
|
+
q: bigint;
|
|
51
|
+
i: string;
|
|
52
|
+
};
|
|
53
|
+
data?: Raster;
|
|
54
|
+
};
|
|
55
|
+
/** @privateRemarks Source: @deck.gl/carto */
|
|
48
56
|
export type Raster = {
|
|
49
57
|
blockSize: number;
|
|
50
58
|
cells: {
|
|
@@ -58,20 +66,20 @@ export type Raster = {
|
|
|
58
66
|
/**
|
|
59
67
|
* Enum for the different types of aggregations available for widgets.
|
|
60
68
|
*
|
|
61
|
-
* @
|
|
62
|
-
* @
|
|
69
|
+
* @privateRemarks Source: @carto/constants
|
|
70
|
+
* @privateRemarks Converted from enum to type union, for improved declarative API.
|
|
63
71
|
*/
|
|
64
72
|
export type AggregationType = 'count' | 'avg' | 'min' | 'max' | 'sum' | 'custom';
|
|
65
73
|
/******************************************************************************
|
|
66
74
|
* FILTERS
|
|
67
75
|
*/
|
|
68
|
-
/** @
|
|
76
|
+
/** @privateRemarks Source: @carto/react-api */
|
|
69
77
|
export type SpatialFilter = Polygon | MultiPolygon;
|
|
70
|
-
/** @
|
|
78
|
+
/** @privateRemarks Source: @deck.gl/carto */
|
|
71
79
|
export interface Filters {
|
|
72
80
|
[column: string]: Filter;
|
|
73
81
|
}
|
|
74
|
-
/** @
|
|
82
|
+
/** @privateRemarks Source: @carto/react-api, @deck.gl/carto */
|
|
75
83
|
export interface Filter {
|
|
76
84
|
[FilterType.IN]?: {
|
|
77
85
|
owner?: string;
|
|
@@ -97,7 +105,7 @@ export interface Filter {
|
|
|
97
105
|
params?: StringSearchOptions;
|
|
98
106
|
};
|
|
99
107
|
}
|
|
100
|
-
/** @
|
|
108
|
+
/** @privateRemarks Source: @carto/react-core */
|
|
101
109
|
export type FilterLogicalOperator = 'and' | 'or';
|
|
102
110
|
/**
|
|
103
111
|
* Type for minimum or maximum value of an interval. Values 'null' and
|
|
@@ -119,7 +127,7 @@ export type StringSearchOptions = {
|
|
|
119
127
|
/**
|
|
120
128
|
* Defines a step size increment for use with {@link TimeSeriesRequestOptions}.
|
|
121
129
|
*
|
|
122
|
-
* @
|
|
130
|
+
* @privateRemarks Source: @carto/react-core
|
|
123
131
|
*/
|
|
124
132
|
export type GroupDateType = 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second';
|
|
125
133
|
/******************************************************************************
|
|
@@ -130,11 +138,11 @@ export type SortColumnType = 'number' | 'string' | 'date';
|
|
|
130
138
|
/******************************************************************************
|
|
131
139
|
* SQL QUERY PARAMETERS
|
|
132
140
|
*/
|
|
133
|
-
/** @
|
|
141
|
+
/** @privateRemarks Source: @deck.gl/carto */
|
|
134
142
|
export type QueryParameterValue = string | number | boolean | Array<QueryParameterValue> | object;
|
|
135
|
-
/** @
|
|
143
|
+
/** @privateRemarks Source: @deck.gl/carto */
|
|
136
144
|
export type NamedQueryParameter = Record<string, QueryParameterValue>;
|
|
137
|
-
/** @
|
|
145
|
+
/** @privateRemarks Source: @deck.gl/carto */
|
|
138
146
|
export type PositionalQueryParameter = QueryParameterValue[];
|
|
139
|
-
/** @
|
|
147
|
+
/** @privateRemarks Source: @deck.gl/carto */
|
|
140
148
|
export type QueryParameters = NamedQueryParameter | PositionalQueryParameter;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { FilterInterval, FilterIntervalComplete } from '../types';
|
|
1
|
+
import { FilterInterval, FilterIntervalComplete } from '../types.js';
|
|
2
2
|
export declare function makeIntervalComplete(intervals: FilterInterval[]): FilterIntervalComplete[];
|
package/build/utils.d.ts
CHANGED
|
@@ -9,14 +9,14 @@ type Row<T> = Record<string, T> | Record<string, T>[] | T[] | T;
|
|
|
9
9
|
* Due to each data warehouse having its own behavior with columns,
|
|
10
10
|
* we need to normalize them and transform every key to lowercase.
|
|
11
11
|
*
|
|
12
|
-
* @
|
|
12
|
+
* @privateRemarks Source: @carto/react-widgets
|
|
13
13
|
* @internal
|
|
14
14
|
*/
|
|
15
15
|
export declare function normalizeObjectKeys<T, R extends Row<T>>(el: R): R;
|
|
16
|
-
/** @
|
|
16
|
+
/** @privateRemarks Source: @carto/react-core */
|
|
17
17
|
export declare function assert(condition: unknown, message: string): asserts condition;
|
|
18
18
|
/**
|
|
19
|
-
* @
|
|
19
|
+
* @privateRemarks Source: @carto/react-core
|
|
20
20
|
* @internal
|
|
21
21
|
*/
|
|
22
22
|
export declare class InvalidColumnError extends Error {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SpatialFilterPolyfillMode, TileResolution } from '../sources/types';
|
|
2
|
-
import { GroupDateType, SortColumnType, SortDirection, SpatialFilter } from '../types';
|
|
1
|
+
import { SpatialFilterPolyfillMode, TileResolution } from '../sources/types.js';
|
|
2
|
+
import { Filters, GroupDateType, SortColumnType, SortDirection, SpatialFilter } from '../types.js';
|
|
3
3
|
/******************************************************************************
|
|
4
4
|
* WIDGET API REQUESTS
|
|
5
5
|
*/
|
|
@@ -15,6 +15,8 @@ interface BaseRequestOptions {
|
|
|
15
15
|
/** Required for table- and query-based spatial index sources (H3, Quadbin). */
|
|
16
16
|
spatialIndexReferenceViewState?: ViewState;
|
|
17
17
|
abortController?: AbortController;
|
|
18
|
+
/** Overrides source filters, if any. */
|
|
19
|
+
filters?: Filters;
|
|
18
20
|
filterOwner?: string;
|
|
19
21
|
}
|
|
20
22
|
/** Options for {@link WidgetRemoteSource#getCategories}. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { H3QuerySourceOptions, QuadbinQuerySourceOptions, VectorQuerySourceOptions } from '../sources/index.js';
|
|
2
2
|
import { WidgetRemoteSource, WidgetRemoteSourceProps } from './widget-remote-source.js';
|
|
3
3
|
import { ModelSource } from '../models/model.js';
|
|
4
|
+
import { Filters } from '../types.js';
|
|
4
5
|
type LayerQuerySourceOptions = Omit<VectorQuerySourceOptions, 'filters'> | Omit<H3QuerySourceOptions, 'filters'> | Omit<QuadbinQuerySourceOptions, 'filters'>;
|
|
5
6
|
export type WidgetQuerySourceResult = {
|
|
6
7
|
widgetSource: WidgetQuerySource;
|
|
@@ -28,6 +29,6 @@ export type WidgetQuerySourceResult = {
|
|
|
28
29
|
* ```
|
|
29
30
|
*/
|
|
30
31
|
export declare class WidgetQuerySource extends WidgetRemoteSource<LayerQuerySourceOptions & WidgetRemoteSourceProps> {
|
|
31
|
-
protected getModelSource(
|
|
32
|
+
protected getModelSource(filters: Filters | undefined, filterOwner?: string): ModelSource;
|
|
32
33
|
}
|
|
33
34
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RasterMetadata } from '../sources/index.js';
|
|
2
|
+
import { WidgetTilesetSource, WidgetTilesetSourceProps } from './widget-tileset-source.js';
|
|
3
|
+
export type WidgetRasterSourceProps = WidgetTilesetSourceProps & {
|
|
4
|
+
rasterMetadata: RasterMetadata;
|
|
5
|
+
spatialDataType: 'quadbin';
|
|
6
|
+
};
|
|
7
|
+
export type WidgetRasterSourceResult = {
|
|
8
|
+
widgetSource: WidgetRasterSource;
|
|
9
|
+
};
|
|
10
|
+
export declare class WidgetRasterSource extends WidgetTilesetSource<WidgetRasterSourceProps> {
|
|
11
|
+
}
|
|
@@ -7,6 +7,9 @@ export type WidgetRemoteSourceProps = WidgetSourceProps;
|
|
|
7
7
|
* Abstract class. Use {@link WidgetQuerySource} or {@link WidgetTableSource}.
|
|
8
8
|
*/
|
|
9
9
|
export declare abstract class WidgetRemoteSource<Props extends WidgetRemoteSourceProps> extends WidgetSource<Props> {
|
|
10
|
+
protected _headers: Record<string, string>;
|
|
11
|
+
/** Assigns HTTP headers to be included on API requests from this source. */
|
|
12
|
+
setRequestHeaders(headers: Record<string, string>): void;
|
|
10
13
|
getCategories(options: CategoryRequestOptions): Promise<CategoryResponse>;
|
|
11
14
|
getFeatures(options: FeaturesRequestOptions): Promise<FeaturesResponse>;
|
|
12
15
|
getFormula(options: FormulaRequestOptions): Promise<FormulaResponse>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CategoryRequestOptions, CategoryResponse, FeaturesRequestOptions, FeaturesResponse, FormulaRequestOptions, FormulaResponse, HistogramRequestOptions, HistogramResponse, RangeRequestOptions, RangeResponse, ScatterRequestOptions, ScatterResponse, TableRequestOptions, TableResponse, TimeSeriesRequestOptions, TimeSeriesResponse, ViewState } from './types.js';
|
|
2
|
-
import { FilterLogicalOperator, Filter, SpatialFilter } from '../types.js';
|
|
2
|
+
import { FilterLogicalOperator, Filter, SpatialFilter, Filters } from '../types.js';
|
|
3
3
|
import { ModelSource } from '../models/model.js';
|
|
4
4
|
import { SourceOptions } from '../sources/index.js';
|
|
5
5
|
import { ApiVersion } from '../constants.js';
|
|
@@ -23,8 +23,8 @@ export declare abstract class WidgetSource<Props extends WidgetSourceProps> {
|
|
|
23
23
|
* properties, and adding additional required properties including 'type' and
|
|
24
24
|
* 'data'.
|
|
25
25
|
*/
|
|
26
|
-
protected abstract getModelSource(
|
|
27
|
-
protected _getModelSource(
|
|
26
|
+
protected abstract getModelSource(filters: Filters | undefined, filterOwner?: string): ModelSource;
|
|
27
|
+
protected _getModelSource(filters: Filters | undefined, filterOwner?: string): Omit<ModelSource, 'type' | 'data'>;
|
|
28
28
|
protected _getSpatialFiltersResolution(source: Omit<ModelSource, 'type' | 'data'>, spatialFilter?: SpatialFilter, referenceViewState?: ViewState): number | undefined;
|
|
29
29
|
/**
|
|
30
30
|
* Returns a list of labeled datapoints for categorical data. Suitable for
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { H3TableSourceOptions, QuadbinTableSourceOptions, VectorTableSourceOptions } from '../sources/index.js';
|
|
2
2
|
import { WidgetRemoteSource, WidgetRemoteSourceProps } from './widget-remote-source.js';
|
|
3
3
|
import { ModelSource } from '../models/model.js';
|
|
4
|
+
import { Filters } from '../types.js';
|
|
4
5
|
type LayerTableSourceOptions = Omit<VectorTableSourceOptions, 'filters'> | Omit<H3TableSourceOptions, 'filters'> | Omit<QuadbinTableSourceOptions, 'filters'>;
|
|
5
6
|
export type WidgetTableSourceResult = {
|
|
6
7
|
widgetSource: WidgetTableSource;
|
|
@@ -28,6 +29,6 @@ export type WidgetTableSourceResult = {
|
|
|
28
29
|
* ```
|
|
29
30
|
*/
|
|
30
31
|
export declare class WidgetTableSource extends WidgetRemoteSource<LayerTableSourceOptions & WidgetRemoteSourceProps> {
|
|
31
|
-
protected getModelSource(
|
|
32
|
+
protected getModelSource(filters: Filters | undefined, filterOwner?: string): ModelSource;
|
|
32
33
|
}
|
|
33
34
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TilesetSourceOptions } from '../sources/index.js';
|
|
2
2
|
import type { ModelSource } from '../models/index.js';
|
|
3
|
-
import { CategoryRequestOptions, CategoryResponse,
|
|
3
|
+
import { CategoryRequestOptions, CategoryResponse, FeaturesResponse, FormulaRequestOptions, FormulaResponse, HistogramRequestOptions, HistogramResponse, RangeRequestOptions, RangeResponse, ScatterRequestOptions, ScatterResponse, TableRequestOptions, TableResponse, TimeSeriesRequestOptions, TimeSeriesResponse } from './types.js';
|
|
4
4
|
import { TileFormat } from '../constants.js';
|
|
5
|
-
import { SpatialFilter } from '../types.js';
|
|
5
|
+
import { Filters, SpatialFilter } from '../types.js';
|
|
6
6
|
import { TileFeatureExtractOptions } from '../filters/index.js';
|
|
7
7
|
import { FeatureCollection } from 'geojson';
|
|
8
8
|
import { SpatialDataType } from '../sources/types.js';
|
|
@@ -36,39 +36,38 @@ export type WidgetTilesetSourceResult = {
|
|
|
36
36
|
* const { widgetSource } = await data;
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
|
-
export declare class WidgetTilesetSource extends WidgetSource<
|
|
39
|
+
export declare class WidgetTilesetSource<Props extends WidgetTilesetSourceProps = WidgetTilesetSourceProps> extends WidgetSource<Props> {
|
|
40
40
|
private _tiles;
|
|
41
41
|
private _features;
|
|
42
|
-
|
|
42
|
+
private _tileFeatureExtractOptions;
|
|
43
|
+
private _tileFeatureExtractPreviousInputs;
|
|
44
|
+
protected getModelSource(filters: Filters | undefined, filterOwner: string): ModelSource;
|
|
43
45
|
/**
|
|
44
46
|
* Loads features as a list of tiles (typically provided by deck.gl).
|
|
45
47
|
* After tiles are loaded, {@link extractTileFeatures} must be called
|
|
46
48
|
* before computing statistics on the tiles.
|
|
47
49
|
*/
|
|
48
50
|
loadTiles(tiles: unknown[]): void;
|
|
51
|
+
/** Configures options used to extract features from tiles. */
|
|
52
|
+
setTileFeatureExtractOptions(options: TileFeatureExtractOptions): void;
|
|
53
|
+
protected _extractTileFeatures(spatialFilter: SpatialFilter): void;
|
|
49
54
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
55
|
+
* Loads features as GeoJSON (used for testing).
|
|
56
|
+
* @experimental
|
|
57
|
+
* @internal Not for public use. Spatial filters in other method calls will be ignored.
|
|
52
58
|
*/
|
|
53
|
-
|
|
54
|
-
spatialFilter: SpatialFilter;
|
|
55
|
-
uniqueIdProperty?: string;
|
|
56
|
-
options?: TileFeatureExtractOptions;
|
|
57
|
-
}): void;
|
|
58
|
-
/** Loads features as GeoJSON (used for testing). */
|
|
59
|
-
loadGeoJSON({ geojson, spatialFilter, uniqueIdProperty, }: {
|
|
59
|
+
loadGeoJSON({ geojson, spatialFilter, }: {
|
|
60
60
|
geojson: FeatureCollection;
|
|
61
61
|
spatialFilter: SpatialFilter;
|
|
62
|
-
uniqueIdProperty?: string;
|
|
63
62
|
}): void;
|
|
64
|
-
getFeatures(
|
|
65
|
-
getFormula({ column, operation, joinOperation, filterOwner, }: FormulaRequestOptions): Promise<FormulaResponse>;
|
|
66
|
-
getHistogram({ operation, ticks, column, joinOperation, filterOwner, }: HistogramRequestOptions): Promise<HistogramResponse>;
|
|
67
|
-
getCategories({ column, operation, operationColumn, joinOperation, filterOwner, }: CategoryRequestOptions): Promise<CategoryResponse>;
|
|
68
|
-
getScatter({ xAxisColumn, yAxisColumn, xAxisJoinOperation, yAxisJoinOperation, filterOwner, }: ScatterRequestOptions): Promise<ScatterResponse>;
|
|
69
|
-
getTable(
|
|
70
|
-
getTimeSeries({ column, stepSize, operation, operationColumn, joinOperation, filterOwner, }: TimeSeriesRequestOptions): Promise<TimeSeriesResponse>;
|
|
71
|
-
getRange({ column, filterOwner, }: RangeRequestOptions): Promise<RangeResponse>;
|
|
63
|
+
getFeatures(): Promise<FeaturesResponse>;
|
|
64
|
+
getFormula({ column, operation, joinOperation, filters, filterOwner, spatialFilter, }: FormulaRequestOptions): Promise<FormulaResponse>;
|
|
65
|
+
getHistogram({ operation, ticks, column, joinOperation, filters, filterOwner, spatialFilter, }: HistogramRequestOptions): Promise<HistogramResponse>;
|
|
66
|
+
getCategories({ column, operation, operationColumn, joinOperation, filters, filterOwner, spatialFilter, }: CategoryRequestOptions): Promise<CategoryResponse>;
|
|
67
|
+
getScatter({ xAxisColumn, yAxisColumn, xAxisJoinOperation, yAxisJoinOperation, filters, filterOwner, spatialFilter, }: ScatterRequestOptions): Promise<ScatterResponse>;
|
|
68
|
+
getTable({ columns, searchFilterColumn, searchFilterText, sortBy, sortDirection, sortByColumnType, offset, limit, filters, filterOwner, spatialFilter, }: TableRequestOptions): Promise<TableResponse>;
|
|
69
|
+
getTimeSeries({ column, stepSize, operation, operationColumn, joinOperation, filters, filterOwner, spatialFilter, }: TimeSeriesRequestOptions): Promise<TimeSeriesResponse>;
|
|
70
|
+
getRange({ column, filters, filterOwner, spatialFilter, }: RangeRequestOptions): Promise<RangeResponse>;
|
|
72
71
|
/****************************************************************************
|
|
73
72
|
* INTERNAL
|
|
74
73
|
*/
|
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carto/api-client",
|
|
3
3
|
"description": "Client library for CARTO APIs and framework-agnostic CARTO + deck.gl applications",
|
|
4
|
-
"repository":
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/CartoDB/carto-api-client.git"
|
|
7
|
+
},
|
|
8
|
+
"homepage": "https://github.com/CartoDB/carto-api-client#readme",
|
|
5
9
|
"author": "Don McCurdy <donmccurdy@carto.com>",
|
|
6
10
|
"packageManager": "yarn@4.3.1",
|
|
7
|
-
"version": "0.5.0-alpha.
|
|
11
|
+
"version": "0.5.0-alpha.4",
|
|
8
12
|
"license": "MIT",
|
|
9
13
|
"publishConfig": {
|
|
10
14
|
"access": "public",
|
|
@@ -35,11 +39,12 @@
|
|
|
35
39
|
"test": "vitest run --typecheck",
|
|
36
40
|
"test:watch": "vitest watch --typecheck",
|
|
37
41
|
"coverage": "vitest run --coverage.enabled --coverage.all false",
|
|
38
|
-
"lint": "
|
|
39
|
-
"format": "prettier \"**/*.{cjs,html,js,json,md,ts}\" --
|
|
42
|
+
"lint": "eslint .",
|
|
43
|
+
"format": "prettier \"**/*.{cjs,html,js,json,md,ts}\" --write",
|
|
44
|
+
"format:check": "prettier \"**/*.{cjs,html,js,json,md,ts}\" --check",
|
|
40
45
|
"clean": "rimraf build/*",
|
|
41
46
|
"postversion": "yarn postversion:check && yarn postversion:commit && yarn postversion:push",
|
|
42
|
-
"postversion:check": "yarn lint && yarn test",
|
|
47
|
+
"postversion:check": "yarn lint && yarn format:check && yarn test",
|
|
43
48
|
"postversion:commit": "node scripts/postversion-commit.js",
|
|
44
49
|
"postversion:push": "git push && git push --tags",
|
|
45
50
|
"prepublish": "yarn lint && yarn test",
|
|
@@ -53,51 +58,58 @@
|
|
|
53
58
|
],
|
|
54
59
|
"dependencies": {
|
|
55
60
|
"@loaders.gl/schema": "^4.3.3",
|
|
56
|
-
"@turf/bbox-clip": "^7.
|
|
57
|
-
"@turf/bbox-polygon": "^7.
|
|
58
|
-
"@turf/boolean-
|
|
59
|
-
"@turf/boolean-
|
|
60
|
-
"@turf/
|
|
61
|
-
"@turf/
|
|
62
|
-
"@turf/
|
|
63
|
-
"@turf/
|
|
64
|
-
"@
|
|
65
|
-
"
|
|
61
|
+
"@turf/bbox-clip": "^7.2.0",
|
|
62
|
+
"@turf/bbox-polygon": "^7.2.0",
|
|
63
|
+
"@turf/boolean-equal": "^7.2.0",
|
|
64
|
+
"@turf/boolean-intersects": "^7.2.0",
|
|
65
|
+
"@turf/boolean-within": "^7.2.0",
|
|
66
|
+
"@turf/helpers": "^7.2.0",
|
|
67
|
+
"@turf/intersect": "^7.2.0",
|
|
68
|
+
"@turf/invariant": "^7.2.0",
|
|
69
|
+
"@turf/union": "^7.2.0",
|
|
70
|
+
"@types/geojson": "^7946.0.16",
|
|
71
|
+
"h3-js": "4.1.0",
|
|
72
|
+
"quadbin": "^0.4.0-alpha.2"
|
|
66
73
|
},
|
|
67
74
|
"devDependencies": {
|
|
68
|
-
"@deck.gl/aggregation-layers": "
|
|
69
|
-
"@deck.gl/carto": "
|
|
70
|
-
"@deck.gl/core": "
|
|
71
|
-
"@deck.gl/extensions": "
|
|
72
|
-
"@deck.gl/geo-layers": "
|
|
73
|
-
"@deck.gl/layers": "
|
|
74
|
-
"@deck.gl/mesh-layers": "
|
|
75
|
-
"@
|
|
76
|
-
"@lit/
|
|
75
|
+
"@deck.gl/aggregation-layers": "~9.1.0",
|
|
76
|
+
"@deck.gl/carto": "~9.1.0",
|
|
77
|
+
"@deck.gl/core": "~9.1.0",
|
|
78
|
+
"@deck.gl/extensions": "~9.1.0",
|
|
79
|
+
"@deck.gl/geo-layers": "~9.1.0",
|
|
80
|
+
"@deck.gl/layers": "~9.1.0",
|
|
81
|
+
"@deck.gl/mesh-layers": "~9.1.0",
|
|
82
|
+
"@eslint/js": "^9.20.0",
|
|
83
|
+
"@lit/react": "^1.0.7",
|
|
84
|
+
"@lit/task": "^1.0.2",
|
|
77
85
|
"@loaders.gl/core": "^4.3.3",
|
|
78
|
-
"@luma.gl/core": "9.0
|
|
79
|
-
"@luma.gl/engine": "9.0
|
|
86
|
+
"@luma.gl/core": "~9.1.0",
|
|
87
|
+
"@luma.gl/engine": "~9.1.0",
|
|
88
|
+
"@luma.gl/shadertools": "~9.1.0",
|
|
89
|
+
"@turf/buffer": "^7.2.0",
|
|
80
90
|
"@types/json-schema": "^7.0.15",
|
|
81
91
|
"@types/react": "^18.3.18",
|
|
82
92
|
"@types/semver": "^7.5.8",
|
|
83
|
-
"@vitest/coverage-istanbul": "^
|
|
93
|
+
"@vitest/coverage-istanbul": "^3.0.5",
|
|
84
94
|
"@webcomponents/webcomponentsjs": "^2.8.0",
|
|
85
95
|
"concurrently": "^9.1.2",
|
|
86
96
|
"echarts": "^5.6.0",
|
|
97
|
+
"eslint": "^9.20.1",
|
|
87
98
|
"lit": "^3.2.1",
|
|
88
99
|
"lit-analyzer": "^2.0.3",
|
|
89
|
-
"maplibre-gl": "^5.
|
|
100
|
+
"maplibre-gl": "^5.1.0",
|
|
90
101
|
"microbundle": "^0.15.1",
|
|
91
102
|
"prettier": "^3.4.2",
|
|
92
103
|
"rimraf": "^6.0.1",
|
|
93
|
-
"semver": "^7.
|
|
104
|
+
"semver": "^7.7.1",
|
|
94
105
|
"thenby": "^1.3.4",
|
|
95
106
|
"typescript": "~5.7.3",
|
|
96
|
-
"
|
|
97
|
-
"
|
|
107
|
+
"typescript-eslint": "^8.24.0",
|
|
108
|
+
"vite": "^6.1.0",
|
|
109
|
+
"vitest": "3.0.5"
|
|
98
110
|
},
|
|
99
111
|
"resolutions": {
|
|
100
112
|
"rollup": "^4.20.0"
|
|
101
113
|
},
|
|
102
|
-
"stableVersion": "0.4.
|
|
114
|
+
"stableVersion": "0.4.6"
|
|
103
115
|
}
|
package/src/api/query.ts
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {SOURCE_DEFAULTS} from '../sources/index';
|
|
5
|
+
import {SOURCE_DEFAULTS} from '../sources/index.js';
|
|
6
6
|
import type {
|
|
7
7
|
SourceOptions,
|
|
8
8
|
QuerySourceOptions,
|
|
9
9
|
QueryResult,
|
|
10
|
-
} from '../sources/types';
|
|
11
|
-
import {buildQueryUrl} from './endpoints';
|
|
12
|
-
import {requestWithParameters} from './request-with-parameters';
|
|
13
|
-
import {APIErrorContext} from './carto-api-error';
|
|
10
|
+
} from '../sources/types.js';
|
|
11
|
+
import {buildQueryUrl} from './endpoints.js';
|
|
12
|
+
import {requestWithParameters} from './request-with-parameters.js';
|
|
13
|
+
import {APIErrorContext} from './carto-api-error.js';
|
|
14
14
|
|
|
15
15
|
export type QueryOptions = SourceOptions & QuerySourceOptions;
|
|
16
16
|
type UrlParameters = {q: string; queryParameters?: string};
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {isPureObject} from '../utils';
|
|
6
|
-
import {CartoAPIError, APIErrorContext} from './carto-api-error';
|
|
7
|
-
import {V3_MINOR_VERSION} from '../constants-internal';
|
|
8
|
-
import {DEFAULT_MAX_LENGTH_URL} from '../constants-internal';
|
|
9
|
-
import {getClient} from '../client';
|
|
10
|
-
import {LocalCacheOptions} from '../sources/types';
|
|
5
|
+
import {isPureObject} from '../utils.js';
|
|
6
|
+
import {CartoAPIError, APIErrorContext} from './carto-api-error.js';
|
|
7
|
+
import {V3_MINOR_VERSION} from '../constants-internal.js';
|
|
8
|
+
import {DEFAULT_MAX_LENGTH_URL} from '../constants-internal.js';
|
|
9
|
+
import {getClient} from '../client.js';
|
|
10
|
+
import {LocalCacheOptions} from '../sources/types.js';
|
|
11
11
|
|
|
12
12
|
const DEFAULT_HEADERS = {
|
|
13
13
|
Accept: 'application/json',
|
package/src/client.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @internal
|
|
3
|
-
* @
|
|
3
|
+
* @privateRemarks Source: @carto/react-core, @carto/constants, @deck.gl/carto
|
|
4
4
|
*/
|
|
5
5
|
let client = 'deck-gl-carto';
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ let client = 'deck-gl-carto';
|
|
|
8
8
|
* Returns current client ID, used to categorize API requests. For internal use only.
|
|
9
9
|
*
|
|
10
10
|
* @internal
|
|
11
|
-
* @
|
|
11
|
+
* @privateRemarks Source: @carto/react-core
|
|
12
12
|
*/
|
|
13
13
|
export function getClient() {
|
|
14
14
|
return client;
|
|
@@ -18,7 +18,7 @@ export function getClient() {
|
|
|
18
18
|
* Sets current client ID, used to categorize API requests. For internal use only.
|
|
19
19
|
*
|
|
20
20
|
* @internal
|
|
21
|
-
* @
|
|
21
|
+
* @privateRemarks Source: @carto/react-core
|
|
22
22
|
*/
|
|
23
23
|
export function setClient(c: string) {
|
|
24
24
|
client = c;
|
|
@@ -7,26 +7,26 @@ export const API_CLIENT_VERSION = __CARTO_API_CLIENT_VERSION;
|
|
|
7
7
|
/** @internal */
|
|
8
8
|
export const V3_MINOR_VERSION = '3.4';
|
|
9
9
|
|
|
10
|
-
/** @
|
|
10
|
+
/** @privateRemarks Source: @carto/constants, @deck.gl/carto */
|
|
11
11
|
export const DEFAULT_GEO_COLUMN = 'geom';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Fastly default limit is 8192; leave some padding.
|
|
15
|
-
* @
|
|
15
|
+
* @privateRemarks Source: @deck.gl/carto
|
|
16
16
|
*/
|
|
17
17
|
export const DEFAULT_MAX_LENGTH_URL = 7000;
|
|
18
18
|
|
|
19
|
-
/** @
|
|
19
|
+
/** @privateRemarks Source: @deck.gl/carto */
|
|
20
20
|
export const DEFAULT_TILE_RESOLUTION = 0.5;
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* @
|
|
23
|
+
* @privateRemarks Source: @deck.gl/carto
|
|
24
24
|
* @internal
|
|
25
25
|
*/
|
|
26
26
|
export const DEFAULT_AGGREGATION_RES_LEVEL_H3 = 4;
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* @
|
|
29
|
+
* @privateRemarks Source: @deck.gl/carto
|
|
30
30
|
* @internal
|
|
31
31
|
*/
|
|
32
32
|
export const DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN = 6;
|
package/src/constants.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* };
|
|
11
11
|
* ```
|
|
12
12
|
*
|
|
13
|
-
* @
|
|
13
|
+
* @privateRemarks Source: @carto/react-api, @deck.gl/carto
|
|
14
14
|
*/
|
|
15
15
|
export enum FilterType {
|
|
16
16
|
IN = 'in',
|
|
@@ -22,17 +22,17 @@ export enum FilterType {
|
|
|
22
22
|
STRING_SEARCH = 'stringSearch',
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
/** @
|
|
25
|
+
/** @privateRemarks Source: @carto/constants */
|
|
26
26
|
export enum ApiVersion {
|
|
27
27
|
V1 = 'v1',
|
|
28
28
|
V2 = 'v2',
|
|
29
29
|
V3 = 'v3',
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
/** @
|
|
32
|
+
/** @privateRemarks Source: @carto/constants, @deck.gl/carto */
|
|
33
33
|
export const DEFAULT_API_BASE_URL = 'https://gcp-us-east1.api.carto.com';
|
|
34
34
|
|
|
35
|
-
/** @
|
|
35
|
+
/** @privateRemarks Source: @carto/react-core */
|
|
36
36
|
export enum TileFormat {
|
|
37
37
|
MVT = 'mvt',
|
|
38
38
|
JSON = 'json',
|
|
@@ -40,14 +40,14 @@ export enum TileFormat {
|
|
|
40
40
|
BINARY = 'binary',
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
/** @
|
|
43
|
+
/** @privateRemarks Source: @carto/react-core */
|
|
44
44
|
export enum SpatialIndex {
|
|
45
45
|
H3 = 'h3',
|
|
46
46
|
S2 = 's2',
|
|
47
47
|
QUADBIN = 'quadbin',
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
/** @
|
|
50
|
+
/** @privateRemarks Source: @carto/react-core */
|
|
51
51
|
export enum Provider {
|
|
52
52
|
BIGQUERY = 'bigquery',
|
|
53
53
|
REDSHIFT = 'redshift',
|