@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
package/build/sources/types.d.ts
DELETED
|
@@ -1,366 +0,0 @@
|
|
|
1
|
-
import type { Feature } from 'geojson';
|
|
2
|
-
import { Filters, Format, QueryParameters } from '../types';
|
|
3
|
-
import { MapInstantiation } from '../types-internal';
|
|
4
|
-
export type SourceRequiredOptions = {
|
|
5
|
-
/** Carto platform access token. */
|
|
6
|
-
accessToken: string;
|
|
7
|
-
/** Data warehouse connection name in Carto platform. */
|
|
8
|
-
connectionName: string;
|
|
9
|
-
};
|
|
10
|
-
export type SourceOptionalOptions = {
|
|
11
|
-
/**
|
|
12
|
-
* Base URL of the CARTO Maps API.
|
|
13
|
-
*
|
|
14
|
-
* Example for account located in EU-west region: `https://gcp-eu-west1.api.carto.com`
|
|
15
|
-
*
|
|
16
|
-
* @default https://gcp-us-east1.api.carto.com
|
|
17
|
-
*/
|
|
18
|
-
apiBaseUrl: string;
|
|
19
|
-
/**
|
|
20
|
-
* Custom HTTP headers added to map instantiation and data requests.
|
|
21
|
-
*/
|
|
22
|
-
headers: Record<string, string>;
|
|
23
|
-
/**
|
|
24
|
-
* Cache buster value returned by map instantiation.
|
|
25
|
-
*
|
|
26
|
-
* Carto source saves `cache` value of map instantiation response in `cache.value`, so it can be used to
|
|
27
|
-
* check if underlying map data has changed between distinct source requests.
|
|
28
|
-
*/
|
|
29
|
-
cache?: {
|
|
30
|
-
value?: number;
|
|
31
|
-
};
|
|
32
|
-
clientId: string;
|
|
33
|
-
/** @deprecated use `query` instead **/
|
|
34
|
-
format: Format;
|
|
35
|
-
/**
|
|
36
|
-
* Maximum URL character length. Above this limit, requests use POST.
|
|
37
|
-
* Used to avoid browser and CDN limits.
|
|
38
|
-
* @default {@link DEFAULT_MAX_LENGTH_URL}
|
|
39
|
-
*/
|
|
40
|
-
maxLengthURL?: number;
|
|
41
|
-
/**
|
|
42
|
-
* The column name and the type of geospatial support.
|
|
43
|
-
*
|
|
44
|
-
* If not present, defaults to `'geom'` for generic queries, `'quadbin'` for Quadbin sources and `'h3'` for H3 sources.
|
|
45
|
-
*/
|
|
46
|
-
spatialDataColumn?: string;
|
|
47
|
-
/**
|
|
48
|
-
* The type of geospatial support. Defaults to `'geo'`.
|
|
49
|
-
*/
|
|
50
|
-
spatialDataType?: SpatialDataType;
|
|
51
|
-
/**
|
|
52
|
-
* Relative resolution of a tile. Higher values increase density and data size. At `tileResolution = 1`, tile geometry is
|
|
53
|
-
* quantized to a 1024x1024 grid. Increasing or decreasing the resolution will increase or decrease the dimensions of
|
|
54
|
-
* the quantization grid proportionately.
|
|
55
|
-
*
|
|
56
|
-
* Supported `tileResolution` values, with corresponding grid sizes:
|
|
57
|
-
*
|
|
58
|
-
* - 0.25: 256x256
|
|
59
|
-
* - 0.5: 512x512
|
|
60
|
-
* - 1: 1024x1024
|
|
61
|
-
* - 2: 2048x2048
|
|
62
|
-
* - 4: 4096x4096
|
|
63
|
-
*/
|
|
64
|
-
tileResolution?: TileResolution;
|
|
65
|
-
/**
|
|
66
|
-
* By default, local in-memory caching is enabled.
|
|
67
|
-
*/
|
|
68
|
-
localCache?: LocalCacheOptions;
|
|
69
|
-
};
|
|
70
|
-
export type LocalCacheOptions = {
|
|
71
|
-
/**
|
|
72
|
-
* Map that stores requests and their responses.
|
|
73
|
-
*/
|
|
74
|
-
cache?: Map<string, Promise<unknown>>;
|
|
75
|
-
/**
|
|
76
|
-
* Cache control
|
|
77
|
-
* * `no-cache`: If present, the source will always fetch from original source.
|
|
78
|
-
* * `no-store`: If present, source will not store result in cache (for later reuse).
|
|
79
|
-
*
|
|
80
|
-
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#directives
|
|
81
|
-
*/
|
|
82
|
-
cacheControl?: ('no-cache' | 'no-store')[];
|
|
83
|
-
};
|
|
84
|
-
export type SourceOptions = SourceRequiredOptions & Partial<SourceOptionalOptions>;
|
|
85
|
-
export type AggregationOptions = {
|
|
86
|
-
/**
|
|
87
|
-
* Defines the aggregation expressions that will be calculated from the resulting columns on each grid cell.
|
|
88
|
-
*
|
|
89
|
-
* Example:
|
|
90
|
-
*
|
|
91
|
-
* sum(pop) as total_population, avg(rev) as average_revenue
|
|
92
|
-
*/
|
|
93
|
-
aggregationExp: string;
|
|
94
|
-
/**
|
|
95
|
-
* Defines the tile aggregation resolution.
|
|
96
|
-
*
|
|
97
|
-
* @default 6 for quadbin and 4 for h3 sources
|
|
98
|
-
*/
|
|
99
|
-
aggregationResLevel?: number;
|
|
100
|
-
/**
|
|
101
|
-
* Original resolution of the spatial index data as stored in the DW
|
|
102
|
-
*/
|
|
103
|
-
dataResolution?: number;
|
|
104
|
-
};
|
|
105
|
-
export type FilterOptions = {
|
|
106
|
-
/**
|
|
107
|
-
* Filters to apply to the data source on the server
|
|
108
|
-
*/
|
|
109
|
-
filters?: Filters;
|
|
110
|
-
};
|
|
111
|
-
export type QuerySourceOptions = {
|
|
112
|
-
/** Full SQL query with query paremeter placeholders (if any). */
|
|
113
|
-
sqlQuery: string;
|
|
114
|
-
/**
|
|
115
|
-
* Values for named or positional paramteres in the query.
|
|
116
|
-
*
|
|
117
|
-
* The way query parameters are determined by data warehouse.
|
|
118
|
-
*
|
|
119
|
-
* * BigQuery has named query parameters, specified with a dictionary, and referenced by key (`@key`)
|
|
120
|
-
*
|
|
121
|
-
* ```
|
|
122
|
-
* sqlQuery: "SELECT * FROM carto-demo-data.demo_tables.retail_stores WHERE storetype = @type AND revenue > @minRevenue"
|
|
123
|
-
* queryParameters: { type: 'Supermarket', minRevenue: 1000000 }
|
|
124
|
-
* ```
|
|
125
|
-
* * Snowflake supports positional parameters, in the form `:1`, `:2`, etc.
|
|
126
|
-
*
|
|
127
|
-
* ```
|
|
128
|
-
* sqlQuery: "SELECT * FROM demo_db.public.import_retail_stores WHERE storetype = :2 AND revenue > :1
|
|
129
|
-
* queryParameters: [100000, "Supermarket"]
|
|
130
|
-
* ```
|
|
131
|
-
* * Postgres and Redhisft supports positional parameters, but in the form `$1`, `$2`, etc.
|
|
132
|
-
*
|
|
133
|
-
* ```
|
|
134
|
-
* sqlQuery: "SELECT * FROM carto_demo_data.demo_tables.retail_stores WHERE storetype = $2 AND revenue > $1
|
|
135
|
-
* queryParameters: [100000, "Supermarket"]
|
|
136
|
-
* ```
|
|
137
|
-
*/
|
|
138
|
-
queryParameters?: QueryParameters;
|
|
139
|
-
/**
|
|
140
|
-
* Comma-separated aggregation expressions. If assigned on a vector source, source is grouped by geometry and then aggregated.
|
|
141
|
-
*
|
|
142
|
-
* Example:
|
|
143
|
-
*
|
|
144
|
-
* 1 as value, avg(rev) as average_revenue
|
|
145
|
-
*/
|
|
146
|
-
aggregationExp?: string;
|
|
147
|
-
};
|
|
148
|
-
export type TableSourceOptions = {
|
|
149
|
-
/**
|
|
150
|
-
* Fully qualified name of table.
|
|
151
|
-
*/
|
|
152
|
-
tableName: string;
|
|
153
|
-
/**
|
|
154
|
-
* Comma-separated aggregation expressions. If assigned on a vector source, source is grouped by geometry and then aggregated.
|
|
155
|
-
*
|
|
156
|
-
* Example:
|
|
157
|
-
*
|
|
158
|
-
* 1 as value, avg(rev) as average_revenue
|
|
159
|
-
*/
|
|
160
|
-
aggregationExp?: string;
|
|
161
|
-
};
|
|
162
|
-
export type TilesetSourceOptions = {
|
|
163
|
-
/**
|
|
164
|
-
* Fully qualified name of tileset.
|
|
165
|
-
*/
|
|
166
|
-
tableName: string;
|
|
167
|
-
};
|
|
168
|
-
export type ColumnsOption = {
|
|
169
|
-
/**
|
|
170
|
-
* Columns to retrieve from the table.
|
|
171
|
-
*
|
|
172
|
-
* If not present, all columns are returned.
|
|
173
|
-
*/
|
|
174
|
-
columns?: string[];
|
|
175
|
-
};
|
|
176
|
-
export type SpatialDataType = 'geo' | 'h3' | 'quadbin';
|
|
177
|
-
/**
|
|
178
|
-
* Strategy used for covering spatial filter geometry with spatial indexes.
|
|
179
|
-
* See https://docs.carto.com/data-and-analysis/analytics-toolbox-for-bigquery/sql-reference/quadbin#quadbin_polyfill_mode
|
|
180
|
-
* or https://docs.carto.com/data-and-analysis/analytics-toolbox-for-bigquery/sql-reference/h3#h3_polyfill_mode for more information.
|
|
181
|
-
* @internalRemarks Source: cloud-native maps-api
|
|
182
|
-
* */
|
|
183
|
-
export type SpatialFilterPolyfillMode = 'center' | 'intersects' | 'contains';
|
|
184
|
-
export type TilejsonMapInstantiation = MapInstantiation & {
|
|
185
|
-
tilejson: {
|
|
186
|
-
url: string[];
|
|
187
|
-
};
|
|
188
|
-
};
|
|
189
|
-
export type TileResolution = 0.25 | 0.5 | 1 | 2 | 4;
|
|
190
|
-
export interface Tilejson {
|
|
191
|
-
tilejson: string;
|
|
192
|
-
name: string;
|
|
193
|
-
description: string;
|
|
194
|
-
version: string;
|
|
195
|
-
attribution: string;
|
|
196
|
-
scheme: string;
|
|
197
|
-
tiles: string[];
|
|
198
|
-
minzoom: number;
|
|
199
|
-
maxzoom: number;
|
|
200
|
-
bounds: [left: number, bottom: number, right: number, top: number];
|
|
201
|
-
center: [longitute: number, latitude: number, zoom: number];
|
|
202
|
-
vector_layers: VectorLayer[];
|
|
203
|
-
minresolution: number;
|
|
204
|
-
maxresolution: number;
|
|
205
|
-
properties_tiles: string[];
|
|
206
|
-
tilestats: Tilestats;
|
|
207
|
-
tileResolution?: TileResolution;
|
|
208
|
-
/**
|
|
209
|
-
* Resolution of data in spatial-index dataset (e.g. H3, Quadbin).
|
|
210
|
-
*
|
|
211
|
-
* @internal
|
|
212
|
-
*/
|
|
213
|
-
dataresolution?: number;
|
|
214
|
-
/**
|
|
215
|
-
* Array of ratios of dropped features per zoom level.
|
|
216
|
-
*
|
|
217
|
-
* Example: `[0,0,0.5]` - means that 50% of features are dropped at zoom 2 and bigger.
|
|
218
|
-
*
|
|
219
|
-
* @internal
|
|
220
|
-
*/
|
|
221
|
-
fraction_dropped_per_zoom?: number[];
|
|
222
|
-
/**
|
|
223
|
-
* Names of bands - rasters only.
|
|
224
|
-
*
|
|
225
|
-
* @internal
|
|
226
|
-
*/
|
|
227
|
-
raster_bands?: string[];
|
|
228
|
-
/**
|
|
229
|
-
* Raster metadata - rasters only.
|
|
230
|
-
*
|
|
231
|
-
* @internal
|
|
232
|
-
*/
|
|
233
|
-
raster_metadata?: RasterMetadata;
|
|
234
|
-
}
|
|
235
|
-
export interface Tilestats {
|
|
236
|
-
layerCount: number;
|
|
237
|
-
layers: Layer[];
|
|
238
|
-
}
|
|
239
|
-
export interface Layer {
|
|
240
|
-
layer: string;
|
|
241
|
-
count: number;
|
|
242
|
-
attributeCount: number;
|
|
243
|
-
attributes: Attribute[];
|
|
244
|
-
}
|
|
245
|
-
export interface Attribute {
|
|
246
|
-
attribute: string;
|
|
247
|
-
type: string;
|
|
248
|
-
}
|
|
249
|
-
export interface VectorLayer {
|
|
250
|
-
id: string;
|
|
251
|
-
minzoom: number;
|
|
252
|
-
maxzoom: number;
|
|
253
|
-
fields: Record<string, string>;
|
|
254
|
-
geometry_type?: string;
|
|
255
|
-
}
|
|
256
|
-
export type RasterMetadataBandStats = {
|
|
257
|
-
approximated_stats?: boolean;
|
|
258
|
-
min: number;
|
|
259
|
-
max: number;
|
|
260
|
-
mean: number;
|
|
261
|
-
stddev: number;
|
|
262
|
-
sum: number;
|
|
263
|
-
sum_squares: number;
|
|
264
|
-
count: number;
|
|
265
|
-
/**
|
|
266
|
-
* Quantiles by number of buckets.
|
|
267
|
-
*
|
|
268
|
-
* Example:
|
|
269
|
-
* ```ts
|
|
270
|
-
* {
|
|
271
|
-
* // for 3 buckets, first 1/3 of items lies in range [min, 20], second 1/3 is in [20, 40], and last 1/3 is in [40, max]
|
|
272
|
-
* 3: [20, 40],
|
|
273
|
-
* 4: [20, 30, 50], for 4 buckets ...
|
|
274
|
-
* }
|
|
275
|
-
* ```
|
|
276
|
-
*/
|
|
277
|
-
quantiles?: Record<number, number[]>;
|
|
278
|
-
/**
|
|
279
|
-
* Top values by number of values.
|
|
280
|
-
*
|
|
281
|
-
* Key of dictionary is value, value is count.
|
|
282
|
-
* Key order is random.
|
|
283
|
-
*
|
|
284
|
-
* Example:
|
|
285
|
-
* ```
|
|
286
|
-
* {
|
|
287
|
-
* 3: 5, // means there are 5 pixels with value 3
|
|
288
|
-
* 11: 222,
|
|
289
|
-
* 12: 333, // means that 12 is most common value with count 333
|
|
290
|
-
* ... // (assuming 333 was largest value in dict)
|
|
291
|
-
* }
|
|
292
|
-
* ```
|
|
293
|
-
*/
|
|
294
|
-
top_values?: Record<number, number>;
|
|
295
|
-
/**
|
|
296
|
-
* Raster loader version.
|
|
297
|
-
*/
|
|
298
|
-
version?: string;
|
|
299
|
-
};
|
|
300
|
-
export declare enum RasterBandColorinterp {
|
|
301
|
-
Gray = "gray",
|
|
302
|
-
Red = "red",
|
|
303
|
-
Green = "green",
|
|
304
|
-
Blue = "blue",
|
|
305
|
-
Alpha = "alpha",
|
|
306
|
-
Palette = "palette"
|
|
307
|
-
}
|
|
308
|
-
export type RasterMetadataBand = {
|
|
309
|
-
type: string;
|
|
310
|
-
name: string;
|
|
311
|
-
stats: RasterMetadataBandStats;
|
|
312
|
-
/**
|
|
313
|
-
* Known values:
|
|
314
|
-
* * `palette`: use unique value and `colortable` ad default mapping
|
|
315
|
-
* * `red`, `green`, `blue`: use the band as color channel
|
|
316
|
-
* * `gray`: use the band as grayscale
|
|
317
|
-
*/
|
|
318
|
-
colorinterp?: string | RasterBandColorinterp;
|
|
319
|
-
/**
|
|
320
|
-
* Default color mapping for unique values (or if coloprinterp is `palette`)
|
|
321
|
-
*/
|
|
322
|
-
colortable?: Record<string, number[]>;
|
|
323
|
-
/**
|
|
324
|
-
* No value representation.
|
|
325
|
-
* Observed values:
|
|
326
|
-
* * `'nan'` for `NaN`
|
|
327
|
-
* * `number`: both as string as number, so parsing is needed
|
|
328
|
-
*/
|
|
329
|
-
nodata: string | number;
|
|
330
|
-
};
|
|
331
|
-
export type RasterMetadata = {
|
|
332
|
-
block_resolution: number;
|
|
333
|
-
minresolution: number;
|
|
334
|
-
maxresolution: number;
|
|
335
|
-
nodata: number | string;
|
|
336
|
-
bands: RasterMetadataBand[];
|
|
337
|
-
bounds: [left: number, bottom: number, right: number, top: number];
|
|
338
|
-
center: [longitute: number, latitude: number, zoom: number];
|
|
339
|
-
width: number;
|
|
340
|
-
height: number;
|
|
341
|
-
block_width: number;
|
|
342
|
-
block_height: number;
|
|
343
|
-
num_blocks: number;
|
|
344
|
-
num_pixels: number;
|
|
345
|
-
pixel_resolution: number;
|
|
346
|
-
};
|
|
347
|
-
export type TilejsonResult = Tilejson & {
|
|
348
|
-
accessToken: string;
|
|
349
|
-
};
|
|
350
|
-
export type GeojsonResult = {
|
|
351
|
-
type: 'FeatureCollection';
|
|
352
|
-
features: Feature[];
|
|
353
|
-
};
|
|
354
|
-
export type JsonResult = any[];
|
|
355
|
-
export type QueryResult = {
|
|
356
|
-
meta: {
|
|
357
|
-
cacheHit: boolean;
|
|
358
|
-
location: string;
|
|
359
|
-
totalBytesProcessed: string;
|
|
360
|
-
};
|
|
361
|
-
rows: Record<string, any>[];
|
|
362
|
-
schema: {
|
|
363
|
-
name: string;
|
|
364
|
-
type: string;
|
|
365
|
-
}[];
|
|
366
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { WidgetQuerySourceResult } from '../widget-sources/index.js';
|
|
2
|
-
import type { FilterOptions, SourceOptions, QuerySourceOptions, TilejsonResult, ColumnsOption } from './types';
|
|
3
|
-
export type VectorQuerySourceOptions = SourceOptions & QuerySourceOptions & FilterOptions & ColumnsOption;
|
|
4
|
-
export type VectorQuerySourceResponse = TilejsonResult & WidgetQuerySourceResult;
|
|
5
|
-
export declare const vectorQuerySource: (options: VectorQuerySourceOptions) => Promise<VectorQuerySourceResponse>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { WidgetTableSourceResult } from '../widget-sources/index.js';
|
|
2
|
-
import type { FilterOptions, ColumnsOption, SourceOptions, TableSourceOptions, TilejsonResult } from './types';
|
|
3
|
-
export type VectorTableSourceOptions = SourceOptions & TableSourceOptions & FilterOptions & ColumnsOption;
|
|
4
|
-
export type VectorTableSourceResponse = TilejsonResult & WidgetTableSourceResult;
|
|
5
|
-
export declare const vectorTableSource: (options: VectorTableSourceOptions) => Promise<VectorTableSourceResponse>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { WidgetTilesetSourceResult } from '../widget-sources';
|
|
2
|
-
import type { SourceOptions, TilesetSourceOptions, TilejsonResult } from './types';
|
|
3
|
-
export type VectorTilesetSourceOptions = SourceOptions & TilesetSourceOptions;
|
|
4
|
-
export type VectorTilesetSourceResponse = TilejsonResult & WidgetTilesetSourceResult;
|
|
5
|
-
export declare const vectorTilesetSource: (options: VectorTilesetSourceOptions) => Promise<VectorTilesetSourceResponse>;
|
package/build/spatial-index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ModelSource } from './models/model';
|
|
2
|
-
import type { AggregationOptions } from './sources/types';
|
|
3
|
-
import type { ViewState } from './widget-sources';
|
|
4
|
-
export declare function getSpatialFiltersResolution(source: Partial<ModelSource & AggregationOptions>, viewState: ViewState): number | undefined;
|
|
5
|
-
export declare function getHexagonResolution(viewport: {
|
|
6
|
-
zoom: number;
|
|
7
|
-
latitude: number;
|
|
8
|
-
}, tileSize: number): number;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/******************************************************************************
|
|
2
|
-
* COMMON
|
|
3
|
-
*/
|
|
4
|
-
import { Format } from './types';
|
|
5
|
-
/** @internal */
|
|
6
|
-
export type $TODO = any;
|
|
7
|
-
/** @internal */
|
|
8
|
-
export type $IntentionalAny = any;
|
|
9
|
-
/******************************************************************************
|
|
10
|
-
* MAP INSTANTIATION
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* @internalRemarks Source: @deck.gl/carto
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
export declare enum SchemaFieldType {
|
|
17
|
-
Number = "number",
|
|
18
|
-
Bigint = "bigint",
|
|
19
|
-
String = "string",
|
|
20
|
-
Geometry = "geometry",
|
|
21
|
-
Timestamp = "timestamp",
|
|
22
|
-
Object = "object",
|
|
23
|
-
Boolean = "boolean",
|
|
24
|
-
Variant = "variant",
|
|
25
|
-
Unknown = "unknown"
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* @internalRemarks Source: @deck.gl/carto
|
|
29
|
-
* @internal
|
|
30
|
-
*/
|
|
31
|
-
export interface SchemaField {
|
|
32
|
-
name: string;
|
|
33
|
-
type: SchemaFieldType;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* @internalRemarks Source: @deck.gl/carto
|
|
37
|
-
* @internal
|
|
38
|
-
*/
|
|
39
|
-
export interface MapInstantiation extends MapInstantiationFormats {
|
|
40
|
-
nrows: number;
|
|
41
|
-
size?: number;
|
|
42
|
-
schema: SchemaField[];
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* @internalRemarks Source: @deck.gl/carto
|
|
46
|
-
* @internal
|
|
47
|
-
*/
|
|
48
|
-
type MapInstantiationFormats = Record<Format, {
|
|
49
|
-
url: string[];
|
|
50
|
-
error?: any;
|
|
51
|
-
}>;
|
|
52
|
-
/******************************************************************************
|
|
53
|
-
* LOCAL CALCULATIONS
|
|
54
|
-
*/
|
|
55
|
-
export type FeatureData = Record<string, unknown>;
|
|
56
|
-
export {};
|
package/build/types.d.ts
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import type { FilterType } from './constants.js';
|
|
2
|
-
import type { Polygon, MultiPolygon, Feature } from 'geojson';
|
|
3
|
-
import type { BinaryFeature, BinaryFeatureCollection } from '@loaders.gl/schema';
|
|
4
|
-
/******************************************************************************
|
|
5
|
-
* MAPS AND TILES
|
|
6
|
-
*/
|
|
7
|
-
/** @internalRemarks Source: @deck.gl/carto */
|
|
8
|
-
export type Format = 'json' | 'geojson' | 'tilejson';
|
|
9
|
-
/** @internalRemarks Source: @carto/constants, @deck.gl/carto */
|
|
10
|
-
export type MapType = 'boundary' | 'query' | 'table' | 'tileset' | 'raster';
|
|
11
|
-
/**
|
|
12
|
-
* Alias for GeoJSON 'BBox' type, semantically representing a viewport.
|
|
13
|
-
* Order of values is "west", "south", "east", "north".
|
|
14
|
-
*/
|
|
15
|
-
export type Viewport = [number, number, number, number];
|
|
16
|
-
/**
|
|
17
|
-
* Subset of deck.gl's Tile2DHeader type, containing only the properties
|
|
18
|
-
* required for local widget calculations. Deeper dependencies on deck.gl
|
|
19
|
-
* APIs should be minimized within this library: @deck.gl/carto depends
|
|
20
|
-
* on the API client, not the other way around.
|
|
21
|
-
* @internalRemarks Source: @deck.gl/geo-layers
|
|
22
|
-
*/
|
|
23
|
-
export type Tile = {
|
|
24
|
-
index: {
|
|
25
|
-
x: number;
|
|
26
|
-
y: number;
|
|
27
|
-
z: number;
|
|
28
|
-
};
|
|
29
|
-
id: string;
|
|
30
|
-
content: unknown;
|
|
31
|
-
zoom: number;
|
|
32
|
-
bbox: {
|
|
33
|
-
west: number;
|
|
34
|
-
east: number;
|
|
35
|
-
north: number;
|
|
36
|
-
south: number;
|
|
37
|
-
};
|
|
38
|
-
isVisible: boolean;
|
|
39
|
-
data?: BinaryFeatureCollection;
|
|
40
|
-
};
|
|
41
|
-
/** Subset of deck.gl's Tile2DHeader type, for spatial indexes. */
|
|
42
|
-
export type SpatialIndexTile = Tile & {
|
|
43
|
-
data?: (Feature & {
|
|
44
|
-
id: bigint;
|
|
45
|
-
})[];
|
|
46
|
-
};
|
|
47
|
-
/** @internalRemarks Source: @deck.gl/carto */
|
|
48
|
-
export type Raster = {
|
|
49
|
-
blockSize: number;
|
|
50
|
-
cells: {
|
|
51
|
-
numericProps: BinaryFeature['numericProps'];
|
|
52
|
-
properties: BinaryFeature['properties'];
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
/******************************************************************************
|
|
56
|
-
* AGGREGATION
|
|
57
|
-
*/
|
|
58
|
-
/**
|
|
59
|
-
* Enum for the different types of aggregations available for widgets.
|
|
60
|
-
*
|
|
61
|
-
* @internalRemarks Source: @carto/constants
|
|
62
|
-
* @internalRemarks Converted from enum to type union, for improved declarative API.
|
|
63
|
-
*/
|
|
64
|
-
export type AggregationType = 'count' | 'avg' | 'min' | 'max' | 'sum' | 'custom';
|
|
65
|
-
/******************************************************************************
|
|
66
|
-
* FILTERS
|
|
67
|
-
*/
|
|
68
|
-
/** @internalRemarks Source: @carto/react-api */
|
|
69
|
-
export type SpatialFilter = Polygon | MultiPolygon;
|
|
70
|
-
/** @internalRemarks Source: @deck.gl/carto */
|
|
71
|
-
export interface Filters {
|
|
72
|
-
[column: string]: Filter;
|
|
73
|
-
}
|
|
74
|
-
/** @internalRemarks Source: @carto/react-api, @deck.gl/carto */
|
|
75
|
-
export interface Filter {
|
|
76
|
-
[FilterType.IN]?: {
|
|
77
|
-
owner?: string;
|
|
78
|
-
values: number[] | string[];
|
|
79
|
-
};
|
|
80
|
-
/** [a, b] both are included. */
|
|
81
|
-
[FilterType.BETWEEN]?: {
|
|
82
|
-
owner?: string;
|
|
83
|
-
values: number[][];
|
|
84
|
-
};
|
|
85
|
-
/** [a, b) a is included, b is not. */
|
|
86
|
-
[FilterType.CLOSED_OPEN]?: {
|
|
87
|
-
owner?: string;
|
|
88
|
-
values: number[][];
|
|
89
|
-
};
|
|
90
|
-
[FilterType.TIME]?: {
|
|
91
|
-
owner?: string;
|
|
92
|
-
values: number[][];
|
|
93
|
-
};
|
|
94
|
-
[FilterType.STRING_SEARCH]?: {
|
|
95
|
-
owner?: string;
|
|
96
|
-
values: string[];
|
|
97
|
-
params?: StringSearchOptions;
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
/** @internalRemarks Source: @carto/react-core */
|
|
101
|
-
export type FilterLogicalOperator = 'and' | 'or';
|
|
102
|
-
/**
|
|
103
|
-
* Type for minimum or maximum value of an interval. Values 'null' and
|
|
104
|
-
* 'undefined' are intentionally allowed, and represent an unbounded value.
|
|
105
|
-
*/
|
|
106
|
-
export type FilterIntervalExtremum = number | null | undefined;
|
|
107
|
-
export type FilterInterval = [FilterIntervalExtremum, FilterIntervalExtremum];
|
|
108
|
-
export type FilterIntervalComplete = [number, number];
|
|
109
|
-
export type StringSearchOptions = {
|
|
110
|
-
useRegExp?: boolean;
|
|
111
|
-
mustStart?: boolean;
|
|
112
|
-
mustEnd?: boolean;
|
|
113
|
-
caseSensitive?: boolean;
|
|
114
|
-
keepSpecialCharacters?: boolean;
|
|
115
|
-
};
|
|
116
|
-
/******************************************************************************
|
|
117
|
-
* GROUPING
|
|
118
|
-
*/
|
|
119
|
-
/**
|
|
120
|
-
* Defines a step size increment for use with {@link TimeSeriesRequestOptions}.
|
|
121
|
-
*
|
|
122
|
-
* @internalRemarks Source: @carto/react-core
|
|
123
|
-
*/
|
|
124
|
-
export type GroupDateType = 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second';
|
|
125
|
-
/******************************************************************************
|
|
126
|
-
* SORTING
|
|
127
|
-
*/
|
|
128
|
-
export type SortDirection = 'asc' | 'desc';
|
|
129
|
-
export type SortColumnType = 'number' | 'string' | 'date';
|
|
130
|
-
/******************************************************************************
|
|
131
|
-
* SQL QUERY PARAMETERS
|
|
132
|
-
*/
|
|
133
|
-
/** @internalRemarks Source: @deck.gl/carto */
|
|
134
|
-
export type QueryParameterValue = string | number | boolean | Array<QueryParameterValue> | object;
|
|
135
|
-
/** @internalRemarks Source: @deck.gl/carto */
|
|
136
|
-
export type NamedQueryParameter = Record<string, QueryParameterValue>;
|
|
137
|
-
/** @internalRemarks Source: @deck.gl/carto */
|
|
138
|
-
export type PositionalQueryParameter = QueryParameterValue[];
|
|
139
|
-
/** @internalRemarks Source: @deck.gl/carto */
|
|
140
|
-
export type QueryParameters = NamedQueryParameter | PositionalQueryParameter;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns midnight (local time) on the Monday preceeding a given date, in
|
|
3
|
-
* milliseconds since the UNIX epoch.
|
|
4
|
-
*/
|
|
5
|
-
export declare function getMonday(date: number | Date): number;
|
|
6
|
-
/**
|
|
7
|
-
* Returns midnight (UTC) on the Monday preceeding a given date, in
|
|
8
|
-
* milliseconds since the UNIX epoch.
|
|
9
|
-
*/
|
|
10
|
-
export declare function getUTCMonday(date: number | Date): number;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { BBox, Geometry } from 'geojson';
|
|
2
|
-
/**
|
|
3
|
-
* Transform tile coords to WGS84 coordinates.
|
|
4
|
-
*
|
|
5
|
-
* @param geometry - any valid geojson geometry
|
|
6
|
-
* @param bbox - geojson bbox
|
|
7
|
-
*/
|
|
8
|
-
export declare function transformTileCoordsToWGS84<T extends Geometry>(geometry: T, bbox: BBox): T;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { BBox, Geometry } from 'geojson';
|
|
2
|
-
/**
|
|
3
|
-
* Transform WGS84 coordinates to tile coords.
|
|
4
|
-
* It's the inverse of deck.gl coordinate-transform (https://github.com/visgl/deck.gl/blob/master/modules/geo-layers/src/mvt-layer/coordinate-transform.js)
|
|
5
|
-
*
|
|
6
|
-
* @param geometry - any valid geojson geometry
|
|
7
|
-
* @param bbox - geojson bbox
|
|
8
|
-
*/
|
|
9
|
-
export declare function transformToTileCoords<T extends Geometry>(geometry: T, bbox: BBox): T;
|
package/build/utils.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Filter } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* @privateRemarks Source: @carto/react-widgets
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export declare function getApplicableFilters(owner?: string, filters?: Record<string, Filter>): Record<string, Filter>;
|
|
7
|
-
type Row<T> = Record<string, T> | Record<string, T>[] | T[] | T;
|
|
8
|
-
/**
|
|
9
|
-
* Due to each data warehouse having its own behavior with columns,
|
|
10
|
-
* we need to normalize them and transform every key to lowercase.
|
|
11
|
-
*
|
|
12
|
-
* @internalRemarks Source: @carto/react-widgets
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
export declare function normalizeObjectKeys<T, R extends Row<T>>(el: R): R;
|
|
16
|
-
/** @internalRemarks Source: @carto/react-core */
|
|
17
|
-
export declare function assert(condition: unknown, message: string): asserts condition;
|
|
18
|
-
/**
|
|
19
|
-
* @internalRemarks Source: @carto/react-core
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
export declare class InvalidColumnError extends Error {
|
|
23
|
-
protected static readonly NAME = "InvalidColumnError";
|
|
24
|
-
constructor(message: string);
|
|
25
|
-
static is(error: unknown): boolean;
|
|
26
|
-
}
|
|
27
|
-
export declare function isEmptyObject(object: object): boolean;
|
|
28
|
-
/** @internal */
|
|
29
|
-
export declare const isObject: (x: unknown) => boolean;
|
|
30
|
-
/** @internal */
|
|
31
|
-
export declare const isPureObject: (x: any) => boolean;
|
|
32
|
-
export {};
|