@carto/api-client 0.4.7-0 → 0.4.7-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/CHANGELOG.md +17 -1
- package/build/api/carto-api-error.d.ts +26 -0
- package/build/api/endpoints.d.ts +24 -0
- package/build/api/index.d.ts +5 -0
- package/build/api/query.d.ts +3 -0
- package/build/api/request-with-parameters.d.ts +10 -0
- package/build/api-client.cjs +2916 -2741
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.modern.js +3723 -0
- package/build/api-client.modern.js.map +1 -0
- package/build/client.d.ts +14 -0
- package/build/constants-internal.d.ts +26 -0
- package/build/constants.d.ts +53 -0
- package/build/deck/get-data-filter-extension-props.d.ts +28 -0
- package/build/deck/index.d.ts +1 -0
- package/build/filters/Filter.d.ts +25 -0
- package/build/filters/FilterTypes.d.ts +3 -0
- package/build/filters/geosjonFeatures.d.ts +8 -0
- package/build/filters/index.d.ts +6 -0
- package/build/filters/tileFeatures.d.ts +20 -0
- package/build/filters/tileFeaturesGeometries.d.ts +13 -0
- package/build/filters/tileFeaturesSpatialIndex.d.ts +10 -0
- package/build/filters.d.ts +39 -0
- package/build/geo.d.ts +19 -0
- package/build/index.d.ts +16 -0
- package/build/models/common.d.ts +28 -0
- package/build/models/index.d.ts +3 -0
- package/build/models/model.d.ts +37 -0
- package/build/operations/aggregation.d.ts +8 -0
- package/build/operations/applySorting.d.ts +20 -0
- package/build/operations/groupBy.d.ts +15 -0
- package/build/operations/groupByDate.d.ts +11 -0
- package/build/operations/histogram.d.ts +13 -0
- package/build/operations/index.d.ts +6 -0
- package/build/operations/scatterPlot.d.ts +14 -0
- package/build/sources/base-source.d.ts +4 -0
- package/build/sources/boundary-query-source.d.ts +10 -0
- package/build/sources/boundary-table-source.d.ts +8 -0
- package/build/sources/h3-query-source.d.ts +5 -0
- package/build/sources/h3-table-source.d.ts +5 -0
- package/build/sources/h3-tileset-source.d.ts +4 -0
- package/build/sources/index.d.ts +26 -0
- package/build/sources/quadbin-query-source.d.ts +5 -0
- package/build/sources/quadbin-table-source.d.ts +5 -0
- package/build/sources/quadbin-tileset-source.d.ts +4 -0
- package/build/sources/raster-source.d.ts +4 -0
- package/build/sources/types.d.ts +366 -0
- package/build/sources/vector-query-source.d.ts +5 -0
- package/build/sources/vector-table-source.d.ts +5 -0
- package/build/sources/vector-tileset-source.d.ts +4 -0
- package/build/spatial-index.d.ts +14 -0
- package/build/types-internal.d.ts +56 -0
- package/build/types.d.ts +140 -0
- package/build/utils/dateUtils.d.ts +10 -0
- package/build/utils/getTileFormat.d.ts +3 -0
- package/build/utils/makeIntervalComplete.d.ts +2 -0
- package/build/utils/transformTileCoordsToWGS84.d.ts +8 -0
- package/build/utils/transformToTileCoords.d.ts +9 -0
- package/build/utils.d.ts +32 -0
- package/build/widget-sources/index.d.ts +6 -0
- package/build/widget-sources/types.d.ts +162 -0
- package/build/widget-sources/widget-query-source.d.ts +34 -0
- package/build/widget-sources/widget-remote-source.d.ts +18 -0
- package/build/widget-sources/widget-source.d.ts +84 -0
- package/build/widget-sources/widget-table-source.d.ts +34 -0
- package/build/widget-sources/widget-tileset-source.d.ts +75 -0
- package/package.json +18 -19
- package/src/constants-internal.ts +6 -0
- package/src/deck/get-data-filter-extension-props.ts +27 -9
- package/src/filters/tileFeatures.ts +0 -1
- package/src/global.d.ts +8 -3
- package/src/sources/h3-tileset-source.ts +6 -18
- package/src/sources/quadbin-tileset-source.ts +6 -18
- package/src/sources/types.ts +0 -6
- package/src/sources/vector-tileset-source.ts +6 -19
- package/src/widget-sources/types.ts +2 -0
- package/src/widget-sources/widget-remote-source.ts +16 -42
- package/src/widget-sources/widget-source.ts +52 -12
- package/src/widget-sources/widget-tileset-source.ts +341 -196
- package/build/api-client.d.cts +0 -1389
- package/build/api-client.d.ts +0 -1389
- package/build/api-client.js +0 -3676
- package/build/api-client.js.map +0 -1
- package/build/worker.d.ts +0 -2
- package/build/worker.js +0 -1949
- package/build/worker.js.map +0 -1
- package/src/widget-sources/widget-tileset-source-impl.ts +0 -417
- package/src/workers/constants.ts +0 -13
- package/src/workers/types.ts +0 -19
- package/src/workers/widget-tileset-worker.ts +0 -40
package/src/sources/types.ts
CHANGED
|
@@ -191,12 +191,6 @@ export type TilesetSourceOptions = {
|
|
|
191
191
|
* Fully qualified name of tileset.
|
|
192
192
|
*/
|
|
193
193
|
tableName: string;
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Whether to use Web Workers for local widget calculations. Workers
|
|
197
|
-
* are used by default if the runtime environment supports ES Module Workers.
|
|
198
|
-
*/
|
|
199
|
-
widgetWorker?: boolean;
|
|
200
194
|
};
|
|
201
195
|
|
|
202
196
|
export type ColumnsOption = {
|
|
@@ -2,12 +2,6 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {DEFAULT_GEO_COLUMN} from '../constants-internal.js';
|
|
6
|
-
import {getTileFormat} from '../utils/getTileFormat.js';
|
|
7
|
-
import {
|
|
8
|
-
WidgetTilesetSource,
|
|
9
|
-
WidgetTilesetSourceResult,
|
|
10
|
-
} from '../widget-sources/index.js';
|
|
11
5
|
import {baseSource} from './base-source.js';
|
|
12
6
|
import type {
|
|
13
7
|
SourceOptions,
|
|
@@ -18,24 +12,17 @@ import type {
|
|
|
18
12
|
export type VectorTilesetSourceOptions = SourceOptions & TilesetSourceOptions;
|
|
19
13
|
type UrlParameters = {name: string};
|
|
20
14
|
|
|
21
|
-
export type VectorTilesetSourceResponse = TilejsonResult
|
|
22
|
-
WidgetTilesetSourceResult;
|
|
15
|
+
export type VectorTilesetSourceResponse = TilejsonResult;
|
|
23
16
|
|
|
24
17
|
export const vectorTilesetSource = async function (
|
|
25
18
|
options: VectorTilesetSourceOptions
|
|
26
19
|
): Promise<VectorTilesetSourceResponse> {
|
|
27
|
-
const {tableName
|
|
20
|
+
const {tableName} = options;
|
|
28
21
|
const urlParameters: UrlParameters = {name: tableName};
|
|
29
22
|
|
|
30
|
-
return baseSource<UrlParameters>(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
...options,
|
|
35
|
-
tileFormat: getTileFormat(result as TilejsonResult),
|
|
36
|
-
spatialDataColumn,
|
|
37
|
-
spatialDataType: 'geo',
|
|
38
|
-
}),
|
|
39
|
-
})
|
|
23
|
+
return baseSource<UrlParameters>(
|
|
24
|
+
'tileset',
|
|
25
|
+
options,
|
|
26
|
+
urlParameters
|
|
40
27
|
) as Promise<VectorTilesetSourceResponse>;
|
|
41
28
|
};
|
|
@@ -19,6 +19,8 @@ export interface ViewState {
|
|
|
19
19
|
|
|
20
20
|
/** Common options for {@link WidgetRemoteSource} requests. */
|
|
21
21
|
interface BaseRequestOptions {
|
|
22
|
+
/** @deprecated */
|
|
23
|
+
abortController?: AbortController;
|
|
22
24
|
signal?: AbortSignal;
|
|
23
25
|
spatialFilter?: SpatialFilter;
|
|
24
26
|
spatialFiltersMode?: SpatialFilterPolyfillMode;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {executeModel
|
|
1
|
+
import {executeModel} from '../models/index.js';
|
|
2
2
|
import {
|
|
3
3
|
CategoryRequestOptions,
|
|
4
4
|
CategoryResponse,
|
|
@@ -17,12 +17,9 @@ import {
|
|
|
17
17
|
TimeSeriesRequestOptions,
|
|
18
18
|
TimeSeriesResponse,
|
|
19
19
|
} from './types.js';
|
|
20
|
-
import {
|
|
20
|
+
import {normalizeObjectKeys} from '../utils.js';
|
|
21
21
|
import {DEFAULT_TILE_RESOLUTION} from '../constants-internal.js';
|
|
22
22
|
import {WidgetSource, WidgetSourceProps} from './widget-source.js';
|
|
23
|
-
import {Filters} from '../types.js';
|
|
24
|
-
import {ApiVersion} from '../constants.js';
|
|
25
|
-
import {AggregationOptions} from '../sources/types.js';
|
|
26
23
|
|
|
27
24
|
export type WidgetRemoteSourceProps = WidgetSourceProps;
|
|
28
25
|
|
|
@@ -34,36 +31,6 @@ export type WidgetRemoteSourceProps = WidgetSourceProps;
|
|
|
34
31
|
export abstract class WidgetRemoteSource<
|
|
35
32
|
Props extends WidgetRemoteSourceProps,
|
|
36
33
|
> extends WidgetSource<Props> {
|
|
37
|
-
/**
|
|
38
|
-
* Subclasses of {@link WidgetRemoteSource} must implement this method, calling
|
|
39
|
-
* {@link WidgetRemoteSource.prototype._getModelSource} for common source
|
|
40
|
-
* properties, and adding additional required properties including 'type' and
|
|
41
|
-
* 'data'.
|
|
42
|
-
*/
|
|
43
|
-
protected abstract getModelSource(
|
|
44
|
-
filters: Filters | undefined,
|
|
45
|
-
filterOwner?: string
|
|
46
|
-
): ModelSource;
|
|
47
|
-
|
|
48
|
-
protected _getModelSource(
|
|
49
|
-
filters: Filters | undefined,
|
|
50
|
-
filterOwner?: string
|
|
51
|
-
): Omit<ModelSource, 'type' | 'data'> {
|
|
52
|
-
const props = this.props;
|
|
53
|
-
return {
|
|
54
|
-
apiVersion: props.apiVersion as ApiVersion,
|
|
55
|
-
apiBaseUrl: props.apiBaseUrl as string,
|
|
56
|
-
clientId: props.clientId as string,
|
|
57
|
-
accessToken: props.accessToken,
|
|
58
|
-
connectionName: props.connectionName,
|
|
59
|
-
filters: getApplicableFilters(filterOwner, filters || props.filters),
|
|
60
|
-
filtersLogicalOperator: props.filtersLogicalOperator,
|
|
61
|
-
spatialDataType: props.spatialDataType,
|
|
62
|
-
spatialDataColumn: props.spatialDataColumn,
|
|
63
|
-
dataResolution: (props as Partial<AggregationOptions>).dataResolution,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
34
|
async getCategories(
|
|
68
35
|
options: CategoryRequestOptions
|
|
69
36
|
): Promise<CategoryResponse> {
|
|
@@ -107,7 +74,8 @@ export abstract class WidgetRemoteSource<
|
|
|
107
74
|
options: FeaturesRequestOptions
|
|
108
75
|
): Promise<FeaturesResponse> {
|
|
109
76
|
const {
|
|
110
|
-
|
|
77
|
+
abortController,
|
|
78
|
+
signal = abortController?.signal,
|
|
111
79
|
filters = this.props.filters,
|
|
112
80
|
filterOwner,
|
|
113
81
|
spatialFilter,
|
|
@@ -148,7 +116,8 @@ export abstract class WidgetRemoteSource<
|
|
|
148
116
|
|
|
149
117
|
async getFormula(options: FormulaRequestOptions): Promise<FormulaResponse> {
|
|
150
118
|
const {
|
|
151
|
-
|
|
119
|
+
abortController,
|
|
120
|
+
signal = abortController?.signal,
|
|
152
121
|
filters = this.props.filters,
|
|
153
122
|
filterOwner,
|
|
154
123
|
spatialFilter,
|
|
@@ -188,7 +157,8 @@ export abstract class WidgetRemoteSource<
|
|
|
188
157
|
options: HistogramRequestOptions
|
|
189
158
|
): Promise<HistogramResponse> {
|
|
190
159
|
const {
|
|
191
|
-
|
|
160
|
+
abortController,
|
|
161
|
+
signal = abortController?.signal,
|
|
192
162
|
filters = this.props.filters,
|
|
193
163
|
filterOwner,
|
|
194
164
|
spatialFilter,
|
|
@@ -233,7 +203,8 @@ export abstract class WidgetRemoteSource<
|
|
|
233
203
|
|
|
234
204
|
async getRange(options: RangeRequestOptions): Promise<RangeResponse> {
|
|
235
205
|
const {
|
|
236
|
-
|
|
206
|
+
abortController,
|
|
207
|
+
signal = abortController?.signal,
|
|
237
208
|
filters = this.props.filters,
|
|
238
209
|
filterOwner,
|
|
239
210
|
spatialFilter,
|
|
@@ -266,7 +237,8 @@ export abstract class WidgetRemoteSource<
|
|
|
266
237
|
|
|
267
238
|
async getScatter(options: ScatterRequestOptions): Promise<ScatterResponse> {
|
|
268
239
|
const {
|
|
269
|
-
|
|
240
|
+
abortController,
|
|
241
|
+
signal = abortController?.signal,
|
|
270
242
|
filters = this.props.filters,
|
|
271
243
|
filterOwner,
|
|
272
244
|
spatialFilter,
|
|
@@ -312,7 +284,8 @@ export abstract class WidgetRemoteSource<
|
|
|
312
284
|
|
|
313
285
|
async getTable(options: TableRequestOptions): Promise<TableResponse> {
|
|
314
286
|
const {
|
|
315
|
-
|
|
287
|
+
abortController,
|
|
288
|
+
signal = abortController?.signal,
|
|
316
289
|
filters = this.props.filters,
|
|
317
290
|
filterOwner,
|
|
318
291
|
spatialFilter,
|
|
@@ -360,7 +333,8 @@ export abstract class WidgetRemoteSource<
|
|
|
360
333
|
options: TimeSeriesRequestOptions
|
|
361
334
|
): Promise<TimeSeriesResponse> {
|
|
362
335
|
const {
|
|
363
|
-
|
|
336
|
+
abortController,
|
|
337
|
+
signal = abortController?.signal,
|
|
364
338
|
filters = this.props.filters,
|
|
365
339
|
filterOwner,
|
|
366
340
|
spatialFilter,
|
|
@@ -17,12 +17,19 @@ import {
|
|
|
17
17
|
TimeSeriesResponse,
|
|
18
18
|
ViewState,
|
|
19
19
|
} from './types.js';
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
FilterLogicalOperator,
|
|
22
|
+
Filter,
|
|
23
|
+
SpatialFilter,
|
|
24
|
+
Filters,
|
|
25
|
+
} from '../types.js';
|
|
26
|
+
import {getApplicableFilters} from '../utils.js';
|
|
21
27
|
import {getClient} from '../client.js';
|
|
22
28
|
import {ModelSource} from '../models/model.js';
|
|
23
29
|
import {SourceOptions} from '../sources/index.js';
|
|
24
30
|
import {ApiVersion, DEFAULT_API_BASE_URL} from '../constants.js';
|
|
25
31
|
import {getSpatialFiltersResolution} from '../spatial-index.js';
|
|
32
|
+
import {AggregationOptions} from '../sources/types.js';
|
|
26
33
|
|
|
27
34
|
export interface WidgetSourceProps extends Omit<SourceOptions, 'filters'> {
|
|
28
35
|
apiVersion?: ApiVersion;
|
|
@@ -35,9 +42,7 @@ export interface WidgetSourceProps extends Omit<SourceOptions, 'filters'> {
|
|
|
35
42
|
*
|
|
36
43
|
* Abstract class. Use {@link WidgetQuerySource} or {@link WidgetTableSource}.
|
|
37
44
|
*/
|
|
38
|
-
export abstract class WidgetSource<
|
|
39
|
-
Props extends WidgetSourceProps = WidgetSourceProps,
|
|
40
|
-
> {
|
|
45
|
+
export abstract class WidgetSource<Props extends WidgetSourceProps> {
|
|
41
46
|
readonly props: Props;
|
|
42
47
|
|
|
43
48
|
static defaultProps: Partial<WidgetSourceProps> = {
|
|
@@ -49,18 +54,41 @@ export abstract class WidgetSource<
|
|
|
49
54
|
};
|
|
50
55
|
|
|
51
56
|
constructor(props: Props) {
|
|
52
|
-
this.props = {
|
|
57
|
+
this.props = {
|
|
58
|
+
...WidgetSource.defaultProps,
|
|
59
|
+
clientId: getClient(), // Refresh clientId, default may have changed.
|
|
60
|
+
...props,
|
|
61
|
+
};
|
|
53
62
|
}
|
|
54
63
|
|
|
55
64
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* and stability if many (10+) sources are created and not released.
|
|
65
|
+
* Subclasses of {@link WidgetRemoteSource} must implement this method, calling
|
|
66
|
+
* {@link WidgetRemoteSource.prototype._getModelSource} for common source
|
|
67
|
+
* properties, and adding additional required properties including 'type' and
|
|
68
|
+
* 'data'.
|
|
61
69
|
*/
|
|
62
|
-
|
|
63
|
-
|
|
70
|
+
protected abstract getModelSource(
|
|
71
|
+
filters: Filters | undefined,
|
|
72
|
+
filterOwner?: string
|
|
73
|
+
): ModelSource;
|
|
74
|
+
|
|
75
|
+
protected _getModelSource(
|
|
76
|
+
filters: Filters | undefined,
|
|
77
|
+
filterOwner?: string
|
|
78
|
+
): Omit<ModelSource, 'type' | 'data'> {
|
|
79
|
+
const props = this.props;
|
|
80
|
+
return {
|
|
81
|
+
apiVersion: props.apiVersion as ApiVersion,
|
|
82
|
+
apiBaseUrl: props.apiBaseUrl as string,
|
|
83
|
+
clientId: props.clientId as string,
|
|
84
|
+
accessToken: props.accessToken,
|
|
85
|
+
connectionName: props.connectionName,
|
|
86
|
+
filters: getApplicableFilters(filterOwner, filters || props.filters),
|
|
87
|
+
filtersLogicalOperator: props.filtersLogicalOperator,
|
|
88
|
+
spatialDataType: props.spatialDataType,
|
|
89
|
+
spatialDataColumn: props.spatialDataColumn,
|
|
90
|
+
dataResolution: (props as Partial<AggregationOptions>).dataResolution,
|
|
91
|
+
};
|
|
64
92
|
}
|
|
65
93
|
|
|
66
94
|
protected _getSpatialFiltersResolution(
|
|
@@ -143,3 +171,15 @@ export abstract class WidgetSource<
|
|
|
143
171
|
options: TimeSeriesRequestOptions
|
|
144
172
|
): Promise<TimeSeriesResponse>;
|
|
145
173
|
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* @todo TODO(v0.5): Remove WidgetBaseSourceProps alias
|
|
177
|
+
* @deprecated Use WidgetSourceProps.
|
|
178
|
+
*/
|
|
179
|
+
export type WidgetBaseSourceProps = WidgetSourceProps;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* @todo TODO(v0.5): Remove WidgetBaseSource alias.
|
|
183
|
+
* @deprecated Use WidgetSourceP.
|
|
184
|
+
*/
|
|
185
|
+
export const WidgetBaseSource = WidgetSource;
|