@carto/api-client 0.5.0-alpha.1 → 0.5.0-alpha.11
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-client.cjs +3163 -3206
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +1389 -0
- package/build/api-client.d.ts +1389 -0
- package/build/api-client.js +3674 -0
- package/build/api-client.js.map +1 -0
- package/build/worker.d.ts +2 -0
- package/build/worker.js +1949 -0
- package/build/worker.js.map +1 -0
- package/package.json +60 -45
- 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 -11
- 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 +12 -17
- package/src/filters.ts +4 -4
- package/src/geo.ts +12 -14
- package/src/global.d.ts +3 -8
- package/src/index.ts +3 -0
- package/src/models/common.ts +11 -9
- 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 +2 -2
- package/src/sources/types.ts +9 -3
- 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 +15 -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 +6 -4
- package/src/widget-sources/widget-query-source.ts +6 -2
- package/src/widget-sources/widget-remote-source.ts +67 -26
- package/src/widget-sources/widget-source.ts +10 -25
- package/src/widget-sources/widget-table-source.ts +6 -2
- package/src/widget-sources/widget-tileset-source-impl.ts +417 -0
- package/src/widget-sources/widget-tileset-source.ts +200 -299
- package/src/workers/constants.ts +13 -0
- package/src/workers/types.ts +19 -0
- package/src/workers/widget-tileset-worker.ts +40 -0
- package/build/api/carto-api-error.d.ts +0 -26
- package/build/api/endpoints.d.ts +0 -24
- package/build/api/index.d.ts +0 -5
- package/build/api/query.d.ts +0 -3
- package/build/api/request-with-parameters.d.ts +0 -10
- package/build/api-client.modern.js +0 -3574
- package/build/api-client.modern.js.map +0 -1
- package/build/client.d.ts +0 -14
- package/build/constants-internal.d.ts +0 -26
- package/build/constants.d.ts +0 -53
- package/build/filters/Filter.d.ts +0 -13
- package/build/filters/FilterTypes.d.ts +0 -3
- package/build/filters/geosjonFeatures.d.ts +0 -8
- package/build/filters/index.d.ts +0 -6
- package/build/filters/tileFeatures.d.ts +0 -20
- package/build/filters/tileFeaturesGeometries.d.ts +0 -13
- package/build/filters/tileFeaturesSpatialIndex.d.ts +0 -10
- package/build/filters.d.ts +0 -39
- package/build/geo.d.ts +0 -19
- package/build/index.d.ts +0 -14
- package/build/models/common.d.ts +0 -27
- package/build/models/index.d.ts +0 -3
- package/build/models/model.d.ts +0 -37
- package/build/operations/aggregation.d.ts +0 -8
- package/build/operations/applySorting.d.ts +0 -20
- package/build/operations/groupBy.d.ts +0 -15
- package/build/operations/groupByDate.d.ts +0 -11
- package/build/operations/histogram.d.ts +0 -13
- package/build/operations/index.d.ts +0 -6
- package/build/operations/scatterPlot.d.ts +0 -14
- package/build/sources/base-source.d.ts +0 -4
- package/build/sources/boundary-query-source.d.ts +0 -10
- package/build/sources/boundary-table-source.d.ts +0 -8
- package/build/sources/h3-query-source.d.ts +0 -5
- package/build/sources/h3-table-source.d.ts +0 -5
- package/build/sources/h3-tileset-source.d.ts +0 -5
- package/build/sources/index.d.ts +0 -26
- package/build/sources/quadbin-query-source.d.ts +0 -5
- package/build/sources/quadbin-table-source.d.ts +0 -5
- package/build/sources/quadbin-tileset-source.d.ts +0 -5
- package/build/sources/raster-source.d.ts +0 -4
- package/build/sources/types.d.ts +0 -366
- package/build/sources/vector-query-source.d.ts +0 -5
- package/build/sources/vector-table-source.d.ts +0 -5
- package/build/sources/vector-tileset-source.d.ts +0 -5
- package/build/spatial-index.d.ts +0 -8
- package/build/types-internal.d.ts +0 -56
- package/build/types.d.ts +0 -140
- package/build/utils/dateUtils.d.ts +0 -10
- package/build/utils/getTileFormat.d.ts +0 -3
- package/build/utils/makeIntervalComplete.d.ts +0 -2
- package/build/utils/transformTileCoordsToWGS84.d.ts +0 -8
- package/build/utils/transformToTileCoords.d.ts +0 -9
- package/build/utils.d.ts +0 -32
- package/build/widget-sources/index.d.ts +0 -5
- package/build/widget-sources/types.d.ts +0 -158
- package/build/widget-sources/widget-query-source.d.ts +0 -33
- package/build/widget-sources/widget-remote-source.d.ts +0 -18
- package/build/widget-sources/widget-source.d.ts +0 -74
- package/build/widget-sources/widget-table-source.d.ts +0 -33
- package/build/widget-sources/widget-tileset-source.d.ts +0 -76
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { SpatialFilterPolyfillMode, TileResolution } from '../sources/types';
|
|
2
|
-
import { GroupDateType, SortColumnType, SortDirection, SpatialFilter } from '../types';
|
|
3
|
-
/******************************************************************************
|
|
4
|
-
* WIDGET API REQUESTS
|
|
5
|
-
*/
|
|
6
|
-
export interface ViewState {
|
|
7
|
-
zoom: number;
|
|
8
|
-
latitude: number;
|
|
9
|
-
longitude: number;
|
|
10
|
-
}
|
|
11
|
-
/** Common options for {@link WidgetRemoteSource} requests. */
|
|
12
|
-
interface BaseRequestOptions {
|
|
13
|
-
spatialFilter?: SpatialFilter;
|
|
14
|
-
spatialFiltersMode?: SpatialFilterPolyfillMode;
|
|
15
|
-
/** Required for table- and query-based spatial index sources (H3, Quadbin). */
|
|
16
|
-
spatialIndexReferenceViewState?: ViewState;
|
|
17
|
-
abortController?: AbortController;
|
|
18
|
-
filterOwner?: string;
|
|
19
|
-
}
|
|
20
|
-
/** Options for {@link WidgetRemoteSource#getCategories}. */
|
|
21
|
-
export interface CategoryRequestOptions extends BaseRequestOptions {
|
|
22
|
-
column: string;
|
|
23
|
-
operation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
|
|
24
|
-
operationColumn?: string;
|
|
25
|
-
/** Local only. */
|
|
26
|
-
joinOperation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Options for {@link WidgetRemoteSource#getFeatures}.
|
|
30
|
-
* @experimental
|
|
31
|
-
* @internal
|
|
32
|
-
*/
|
|
33
|
-
export interface FeaturesRequestOptions extends BaseRequestOptions {
|
|
34
|
-
/**
|
|
35
|
-
* Feature IDs, as found in `_carto_feature_id`. Feature IDs are a hash
|
|
36
|
-
* of geometry, and features with identical geometry will have the same
|
|
37
|
-
* feature ID. Order is important; features in the result set will be
|
|
38
|
-
* sorted according to the order of IDs in the request.
|
|
39
|
-
*/
|
|
40
|
-
featureIds: string[];
|
|
41
|
-
/**
|
|
42
|
-
* Columns to be returned for each picked object. Note that for datasets
|
|
43
|
-
* containing features with identical geometry, more than one result per
|
|
44
|
-
* requested feature ID may be returned. To match results back to the
|
|
45
|
-
* requested feature ID, include `_carto_feature_id` in the columns list.
|
|
46
|
-
*/
|
|
47
|
-
columns: string[];
|
|
48
|
-
/** Topology of objects to be picked. */
|
|
49
|
-
dataType: 'points' | 'lines' | 'polygons';
|
|
50
|
-
/** Zoom level, required if using 'points' data type. */
|
|
51
|
-
z?: number;
|
|
52
|
-
/**
|
|
53
|
-
* Maximum number of objects to return in the result set. For datasets
|
|
54
|
-
* containing features with identical geometry, those features will have
|
|
55
|
-
* the same feature IDs, and so more results may be returned than feature IDs
|
|
56
|
-
* given in the request.
|
|
57
|
-
*/
|
|
58
|
-
limit?: number;
|
|
59
|
-
/**
|
|
60
|
-
* Must match `tileResolution` used when obtaining the `_carto_feature_id`
|
|
61
|
-
* column, typically in a layer's tile requests.
|
|
62
|
-
*/
|
|
63
|
-
tileResolution?: TileResolution;
|
|
64
|
-
}
|
|
65
|
-
/** Options for {@link WidgetRemoteSource#getFormula}. */
|
|
66
|
-
export interface FormulaRequestOptions extends BaseRequestOptions {
|
|
67
|
-
column: string;
|
|
68
|
-
operation?: 'count' | 'avg' | 'min' | 'max' | 'sum' | 'custom';
|
|
69
|
-
operationExp?: string;
|
|
70
|
-
joinOperation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
|
|
71
|
-
}
|
|
72
|
-
/** Options for {@link WidgetRemoteSource#getHistogram}. */
|
|
73
|
-
export interface HistogramRequestOptions extends BaseRequestOptions {
|
|
74
|
-
column: string;
|
|
75
|
-
ticks: number[];
|
|
76
|
-
operation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
|
|
77
|
-
/** Local only. */
|
|
78
|
-
joinOperation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
|
|
79
|
-
}
|
|
80
|
-
/** Options for {@link WidgetRemoteSource#getRange}. */
|
|
81
|
-
export interface RangeRequestOptions extends BaseRequestOptions {
|
|
82
|
-
column: string;
|
|
83
|
-
}
|
|
84
|
-
/** Options for {@link WidgetRemoteSource#getScatter}. */
|
|
85
|
-
export interface ScatterRequestOptions extends BaseRequestOptions {
|
|
86
|
-
xAxisColumn: string;
|
|
87
|
-
xAxisJoinOperation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
|
|
88
|
-
yAxisColumn: string;
|
|
89
|
-
yAxisJoinOperation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
|
|
90
|
-
}
|
|
91
|
-
/** Options for {@link WidgetRemoteSource#getTable}. */
|
|
92
|
-
export interface TableRequestOptions extends BaseRequestOptions {
|
|
93
|
-
columns: string[];
|
|
94
|
-
sortBy?: string;
|
|
95
|
-
sortDirection?: SortDirection;
|
|
96
|
-
sortByColumnType?: SortColumnType;
|
|
97
|
-
offset?: number;
|
|
98
|
-
limit?: number;
|
|
99
|
-
/** Local only. */
|
|
100
|
-
searchFilterColumn?: string;
|
|
101
|
-
/** Local only. */
|
|
102
|
-
searchFilterText?: string;
|
|
103
|
-
}
|
|
104
|
-
/** Options for {@link WidgetRemoteSource#getTimeSeries}. */
|
|
105
|
-
export interface TimeSeriesRequestOptions extends BaseRequestOptions {
|
|
106
|
-
column: string;
|
|
107
|
-
stepSize: GroupDateType;
|
|
108
|
-
stepMultiplier?: number;
|
|
109
|
-
operation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
|
|
110
|
-
operationColumn?: string;
|
|
111
|
-
joinOperation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
|
|
112
|
-
splitByCategory?: string;
|
|
113
|
-
splitByCategoryLimit?: number;
|
|
114
|
-
splitByCategoryValues?: string[];
|
|
115
|
-
}
|
|
116
|
-
/******************************************************************************
|
|
117
|
-
* WIDGET API RESPONSES
|
|
118
|
-
*/
|
|
119
|
-
/**
|
|
120
|
-
* Response from {@link WidgetRemoteSource#getFeatures}.
|
|
121
|
-
* @experimental
|
|
122
|
-
* @internal
|
|
123
|
-
*/
|
|
124
|
-
export type FeaturesResponse = {
|
|
125
|
-
rows: Record<string, unknown>[];
|
|
126
|
-
};
|
|
127
|
-
/** Response from {@link WidgetRemoteSource#getFormula}. */
|
|
128
|
-
export type FormulaResponse = {
|
|
129
|
-
value: number | null;
|
|
130
|
-
};
|
|
131
|
-
/** Response from {@link WidgetRemoteSource#getCategories}. */
|
|
132
|
-
export type CategoryResponse = {
|
|
133
|
-
name: string;
|
|
134
|
-
value: number;
|
|
135
|
-
}[];
|
|
136
|
-
/** Response from {@link WidgetRemoteSource#getRange}. */
|
|
137
|
-
export type RangeResponse = {
|
|
138
|
-
min: number;
|
|
139
|
-
max: number;
|
|
140
|
-
} | null;
|
|
141
|
-
/** Response from {@link WidgetRemoteSource#getTable}. */
|
|
142
|
-
export type TableResponse = {
|
|
143
|
-
totalCount: number;
|
|
144
|
-
rows: Record<string, number | string>[];
|
|
145
|
-
};
|
|
146
|
-
/** Response from {@link WidgetRemoteSource#getScatter}. */
|
|
147
|
-
export type ScatterResponse = [number, number][];
|
|
148
|
-
/** Response from {@link WidgetRemoteSource#getTimeSeries}. */
|
|
149
|
-
export type TimeSeriesResponse = {
|
|
150
|
-
rows: {
|
|
151
|
-
name: string;
|
|
152
|
-
value: number;
|
|
153
|
-
}[];
|
|
154
|
-
categories?: string[];
|
|
155
|
-
};
|
|
156
|
-
/** Response from {@link WidgetRemoteSource#getHistogram}. */
|
|
157
|
-
export type HistogramResponse = number[];
|
|
158
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { H3QuerySourceOptions, QuadbinQuerySourceOptions, VectorQuerySourceOptions } from '../sources/index.js';
|
|
2
|
-
import { WidgetRemoteSource, WidgetRemoteSourceProps } from './widget-remote-source.js';
|
|
3
|
-
import { ModelSource } from '../models/model.js';
|
|
4
|
-
type LayerQuerySourceOptions = Omit<VectorQuerySourceOptions, 'filters'> | Omit<H3QuerySourceOptions, 'filters'> | Omit<QuadbinQuerySourceOptions, 'filters'>;
|
|
5
|
-
export type WidgetQuerySourceResult = {
|
|
6
|
-
widgetSource: WidgetQuerySource;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Source for Widget API requests on a data source defined by a SQL query.
|
|
10
|
-
*
|
|
11
|
-
* Generally not intended to be constructed directly. Instead, call
|
|
12
|
-
* {@link vectorQuerySource}, {@link h3QuerySource}, or {@link quadbinQuerySource},
|
|
13
|
-
* which can be shared with map layers. Sources contain a `widgetSource` property,
|
|
14
|
-
* for use by widget implementations.
|
|
15
|
-
*
|
|
16
|
-
* Example:
|
|
17
|
-
*
|
|
18
|
-
* ```javascript
|
|
19
|
-
* import { vectorQuerySource } from '@carto/api-client';
|
|
20
|
-
*
|
|
21
|
-
* const data = vectorQuerySource({
|
|
22
|
-
* accessToken: '••••',
|
|
23
|
-
* connectionName: 'carto_dw',
|
|
24
|
-
* sqlQuery: 'SELECT * FROM carto-demo-data.demo_tables.retail_stores'
|
|
25
|
-
* });
|
|
26
|
-
*
|
|
27
|
-
* const { widgetSource } = await data;
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export declare class WidgetQuerySource extends WidgetRemoteSource<LayerQuerySourceOptions & WidgetRemoteSourceProps> {
|
|
31
|
-
protected getModelSource(owner: string): ModelSource;
|
|
32
|
-
}
|
|
33
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { CategoryRequestOptions, CategoryResponse, FeaturesRequestOptions, FeaturesResponse, FormulaRequestOptions, FormulaResponse, HistogramRequestOptions, HistogramResponse, RangeRequestOptions, RangeResponse, ScatterRequestOptions, ScatterResponse, TableRequestOptions, TableResponse, TimeSeriesRequestOptions, TimeSeriesResponse } from './types.js';
|
|
2
|
-
import { WidgetSource, WidgetSourceProps } from './widget-source.js';
|
|
3
|
-
export type WidgetRemoteSourceProps = WidgetSourceProps;
|
|
4
|
-
/**
|
|
5
|
-
* Source for Widget API requests.
|
|
6
|
-
*
|
|
7
|
-
* Abstract class. Use {@link WidgetQuerySource} or {@link WidgetTableSource}.
|
|
8
|
-
*/
|
|
9
|
-
export declare abstract class WidgetRemoteSource<Props extends WidgetRemoteSourceProps> extends WidgetSource<Props> {
|
|
10
|
-
getCategories(options: CategoryRequestOptions): Promise<CategoryResponse>;
|
|
11
|
-
getFeatures(options: FeaturesRequestOptions): Promise<FeaturesResponse>;
|
|
12
|
-
getFormula(options: FormulaRequestOptions): Promise<FormulaResponse>;
|
|
13
|
-
getHistogram(options: HistogramRequestOptions): Promise<HistogramResponse>;
|
|
14
|
-
getRange(options: RangeRequestOptions): Promise<RangeResponse>;
|
|
15
|
-
getScatter(options: ScatterRequestOptions): Promise<ScatterResponse>;
|
|
16
|
-
getTable(options: TableRequestOptions): Promise<TableResponse>;
|
|
17
|
-
getTimeSeries(options: TimeSeriesRequestOptions): Promise<TimeSeriesResponse>;
|
|
18
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
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';
|
|
3
|
-
import { ModelSource } from '../models/model.js';
|
|
4
|
-
import { SourceOptions } from '../sources/index.js';
|
|
5
|
-
import { ApiVersion } from '../constants.js';
|
|
6
|
-
export interface WidgetSourceProps extends Omit<SourceOptions, 'filters'> {
|
|
7
|
-
apiVersion?: ApiVersion;
|
|
8
|
-
filters?: Record<string, Filter>;
|
|
9
|
-
filtersLogicalOperator?: FilterLogicalOperator;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Source for Widget API requests on a data source defined by a SQL query.
|
|
13
|
-
*
|
|
14
|
-
* Abstract class. Use {@link WidgetQuerySource} or {@link WidgetTableSource}.
|
|
15
|
-
*/
|
|
16
|
-
export declare abstract class WidgetSource<Props extends WidgetSourceProps> {
|
|
17
|
-
readonly props: Props;
|
|
18
|
-
static defaultProps: Partial<WidgetSourceProps>;
|
|
19
|
-
constructor(props: Props);
|
|
20
|
-
/**
|
|
21
|
-
* Subclasses of {@link WidgetRemoteSource} must implement this method, calling
|
|
22
|
-
* {@link WidgetRemoteSource.prototype._getModelSource} for common source
|
|
23
|
-
* properties, and adding additional required properties including 'type' and
|
|
24
|
-
* 'data'.
|
|
25
|
-
*/
|
|
26
|
-
protected abstract getModelSource(owner: string | undefined): ModelSource;
|
|
27
|
-
protected _getModelSource(owner?: string): Omit<ModelSource, 'type' | 'data'>;
|
|
28
|
-
protected _getSpatialFiltersResolution(source: Omit<ModelSource, 'type' | 'data'>, spatialFilter?: SpatialFilter, referenceViewState?: ViewState): number | undefined;
|
|
29
|
-
/**
|
|
30
|
-
* Returns a list of labeled datapoints for categorical data. Suitable for
|
|
31
|
-
* charts including grouped bar charts, pie charts, and tree charts.
|
|
32
|
-
*/
|
|
33
|
-
abstract getCategories(options: CategoryRequestOptions): Promise<CategoryResponse>;
|
|
34
|
-
/**
|
|
35
|
-
* Given a list of feature IDs (as found in `_carto_feature_id`) returns all
|
|
36
|
-
* matching features. In datasets containing features with duplicate geometries,
|
|
37
|
-
* feature IDs may be duplicated (IDs are a hash of geometry) and so more
|
|
38
|
-
* results may be returned than IDs in the request.
|
|
39
|
-
* @internal
|
|
40
|
-
* @experimental
|
|
41
|
-
*/
|
|
42
|
-
abstract getFeatures(options: FeaturesRequestOptions): Promise<FeaturesResponse>;
|
|
43
|
-
/**
|
|
44
|
-
* Returns a scalar numerical statistic over all matching data. Suitable
|
|
45
|
-
* for 'headline' or 'scorecard' figures such as counts and sums.
|
|
46
|
-
*/
|
|
47
|
-
abstract getFormula(options: FormulaRequestOptions): Promise<FormulaResponse>;
|
|
48
|
-
/**
|
|
49
|
-
* Returns a list of labeled datapoints for 'bins' of data defined as ticks
|
|
50
|
-
* over a numerical range. Suitable for histogram charts.
|
|
51
|
-
*/
|
|
52
|
-
abstract getHistogram(options: HistogramRequestOptions): Promise<HistogramResponse>;
|
|
53
|
-
/**
|
|
54
|
-
* Returns a range (min and max) for a numerical column of matching rows.
|
|
55
|
-
* Suitable for displaying certain 'headline' or 'scorecard' statistics,
|
|
56
|
-
* or rendering a range slider UI for filtering.
|
|
57
|
-
*/
|
|
58
|
-
abstract getRange(options: RangeRequestOptions): Promise<RangeResponse>;
|
|
59
|
-
/**
|
|
60
|
-
* Returns a list of bivariate datapoints defined as numerical 'x' and 'y'
|
|
61
|
-
* values. Suitable for rendering scatter plots.
|
|
62
|
-
*/
|
|
63
|
-
abstract getScatter(options: ScatterRequestOptions): Promise<ScatterResponse>;
|
|
64
|
-
/**
|
|
65
|
-
* Returns a list of arbitrary data rows, with support for pagination and
|
|
66
|
-
* sorting. Suitable for displaying tables and lists.
|
|
67
|
-
*/
|
|
68
|
-
abstract getTable(options: TableRequestOptions): Promise<TableResponse>;
|
|
69
|
-
/**
|
|
70
|
-
* Returns a series of labeled numerical values, grouped into equally-sized
|
|
71
|
-
* time intervals. Suitable for rendering time series charts.
|
|
72
|
-
*/
|
|
73
|
-
abstract getTimeSeries(options: TimeSeriesRequestOptions): Promise<TimeSeriesResponse>;
|
|
74
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { H3TableSourceOptions, QuadbinTableSourceOptions, VectorTableSourceOptions } from '../sources/index.js';
|
|
2
|
-
import { WidgetRemoteSource, WidgetRemoteSourceProps } from './widget-remote-source.js';
|
|
3
|
-
import { ModelSource } from '../models/model.js';
|
|
4
|
-
type LayerTableSourceOptions = Omit<VectorTableSourceOptions, 'filters'> | Omit<H3TableSourceOptions, 'filters'> | Omit<QuadbinTableSourceOptions, 'filters'>;
|
|
5
|
-
export type WidgetTableSourceResult = {
|
|
6
|
-
widgetSource: WidgetTableSource;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Source for Widget API requests on a data source defined as a table.
|
|
10
|
-
*
|
|
11
|
-
* Generally not intended to be constructed directly. Instead, call
|
|
12
|
-
* {@link vectorTableSource}, {@link h3TableSource}, or {@link quadbinTableSource},
|
|
13
|
-
* which can be shared with map layers. Sources contain a `widgetSource` property,
|
|
14
|
-
* for use by widget implementations.
|
|
15
|
-
*
|
|
16
|
-
* Example:
|
|
17
|
-
*
|
|
18
|
-
* ```javascript
|
|
19
|
-
* import { vectorTableSource } from '@carto/api-client';
|
|
20
|
-
*
|
|
21
|
-
* const data = vectorTableSource({
|
|
22
|
-
* accessToken: '••••',
|
|
23
|
-
* connectionName: 'carto_dw',
|
|
24
|
-
* tableName: 'carto-demo-data.demo_tables.retail_stores'
|
|
25
|
-
* });
|
|
26
|
-
*
|
|
27
|
-
* const { widgetSource } = await data;
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export declare class WidgetTableSource extends WidgetRemoteSource<LayerTableSourceOptions & WidgetRemoteSourceProps> {
|
|
31
|
-
protected getModelSource(owner: string): ModelSource;
|
|
32
|
-
}
|
|
33
|
-
export {};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { TilesetSourceOptions } from '../sources/index.js';
|
|
2
|
-
import type { ModelSource } from '../models/index.js';
|
|
3
|
-
import { CategoryRequestOptions, CategoryResponse, FeaturesRequestOptions, FeaturesResponse, FormulaRequestOptions, FormulaResponse, HistogramRequestOptions, HistogramResponse, RangeRequestOptions, RangeResponse, ScatterRequestOptions, ScatterResponse, TableRequestOptions, TableResponse, TimeSeriesRequestOptions, TimeSeriesResponse } from './types.js';
|
|
4
|
-
import { TileFormat } from '../constants.js';
|
|
5
|
-
import { SpatialFilter } from '../types.js';
|
|
6
|
-
import { TileFeatureExtractOptions } from '../filters/index.js';
|
|
7
|
-
import { FeatureCollection } from 'geojson';
|
|
8
|
-
import { SpatialDataType } from '../sources/types.js';
|
|
9
|
-
import { WidgetSource, WidgetSourceProps } from './widget-source.js';
|
|
10
|
-
export type WidgetTilesetSourceProps = WidgetSourceProps & Omit<TilesetSourceOptions, 'filters'> & {
|
|
11
|
-
tileFormat: TileFormat;
|
|
12
|
-
spatialDataType: SpatialDataType;
|
|
13
|
-
};
|
|
14
|
-
export type WidgetTilesetSourceResult = {
|
|
15
|
-
widgetSource: WidgetTilesetSource;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Source for Widget API requests on a data source defined by a tileset.
|
|
19
|
-
*
|
|
20
|
-
* Generally not intended to be constructed directly. Instead, call
|
|
21
|
-
* {@link vectorTilesetSource}, {@link h3TilesetSource}, or {@link quadbinTilesetSource},
|
|
22
|
-
* which can be shared with map layers. Sources contain a `widgetSource`
|
|
23
|
-
* property, for use by widget implementations.
|
|
24
|
-
*
|
|
25
|
-
* Example:
|
|
26
|
-
*
|
|
27
|
-
* ```javascript
|
|
28
|
-
* import { vectorTilesetSource } from '@carto/api-client';
|
|
29
|
-
*
|
|
30
|
-
* const data = vectorTilesetSource({
|
|
31
|
-
* accessToken: '••••',
|
|
32
|
-
* connectionName: 'carto_dw',
|
|
33
|
-
* tableName: 'carto-demo-data.demo_rasters.my_tileset_source'
|
|
34
|
-
* });
|
|
35
|
-
*
|
|
36
|
-
* const { widgetSource } = await data;
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export declare class WidgetTilesetSource extends WidgetSource<WidgetTilesetSourceProps> {
|
|
40
|
-
private _tiles;
|
|
41
|
-
private _features;
|
|
42
|
-
protected getModelSource(owner: string): ModelSource;
|
|
43
|
-
/**
|
|
44
|
-
* Loads features as a list of tiles (typically provided by deck.gl).
|
|
45
|
-
* After tiles are loaded, {@link extractTileFeatures} must be called
|
|
46
|
-
* before computing statistics on the tiles.
|
|
47
|
-
*/
|
|
48
|
-
loadTiles(tiles: unknown[]): void;
|
|
49
|
-
/**
|
|
50
|
-
* Extracts feature data from tiles previously loaded with {@link loadTiles}.
|
|
51
|
-
* Must be called before computing statistics on tiles.
|
|
52
|
-
*/
|
|
53
|
-
extractTileFeatures({ spatialFilter, uniqueIdProperty, options, }: {
|
|
54
|
-
spatialFilter: SpatialFilter;
|
|
55
|
-
uniqueIdProperty?: string;
|
|
56
|
-
options?: TileFeatureExtractOptions;
|
|
57
|
-
}): void;
|
|
58
|
-
/** Loads features as GeoJSON (used for testing). */
|
|
59
|
-
loadGeoJSON({ geojson, spatialFilter, uniqueIdProperty, }: {
|
|
60
|
-
geojson: FeatureCollection;
|
|
61
|
-
spatialFilter: SpatialFilter;
|
|
62
|
-
uniqueIdProperty?: string;
|
|
63
|
-
}): void;
|
|
64
|
-
getFeatures(options: FeaturesRequestOptions): Promise<FeaturesResponse>;
|
|
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(options: TableRequestOptions): Promise<TableResponse>;
|
|
70
|
-
getTimeSeries({ column, stepSize, operation, operationColumn, joinOperation, filterOwner, }: TimeSeriesRequestOptions): Promise<TimeSeriesResponse>;
|
|
71
|
-
getRange({ column, filterOwner, }: RangeRequestOptions): Promise<RangeResponse>;
|
|
72
|
-
/****************************************************************************
|
|
73
|
-
* INTERNAL
|
|
74
|
-
*/
|
|
75
|
-
private _getFilteredFeatures;
|
|
76
|
-
}
|