@carto/api-client 0.5.0-alpha.4 → 0.5.0-alpha.6

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.
Files changed (94) hide show
  1. package/build/api-client.cjs +2803 -2697
  2. package/build/api-client.d.cts +1384 -0
  3. package/build/api-client.d.ts +1384 -0
  4. package/build/api-client.js +1722 -0
  5. package/build/chunk-LEI5PI5X.js +2063 -0
  6. package/build/worker.d.ts +2 -0
  7. package/build/worker.js +23 -0
  8. package/package.json +18 -18
  9. package/src/constants-internal.ts +0 -6
  10. package/src/filters/tileFeatures.ts +10 -26
  11. package/src/global.d.ts +3 -8
  12. package/src/sources/h3-tileset-source.ts +8 -1
  13. package/src/sources/quadbin-tileset-source.ts +8 -1
  14. package/src/sources/raster-source.ts +5 -18
  15. package/src/sources/types.ts +7 -1
  16. package/src/sources/vector-tileset-source.ts +8 -1
  17. package/src/types.ts +0 -6
  18. package/src/widget-sources/index.ts +1 -1
  19. package/src/widget-sources/widget-remote-source.ts +35 -2
  20. package/src/widget-sources/widget-source.ts +1 -38
  21. package/src/widget-sources/widget-tileset-source.ts +9 -20
  22. package/src/widget-sources/widget-tileset-worker-source.ts +268 -0
  23. package/src/workers/constants.ts +13 -0
  24. package/src/workers/types.ts +19 -0
  25. package/src/workers/utils.ts +33 -0
  26. package/src/workers/widget-tileset-worker.ts +39 -0
  27. package/build/api/carto-api-error.d.ts +0 -26
  28. package/build/api/endpoints.d.ts +0 -24
  29. package/build/api/index.d.ts +0 -5
  30. package/build/api/query.d.ts +0 -3
  31. package/build/api/request-with-parameters.d.ts +0 -10
  32. package/build/api-client.cjs.map +0 -1
  33. package/build/api-client.modern.js +0 -3445
  34. package/build/api-client.modern.js.map +0 -1
  35. package/build/client.d.ts +0 -14
  36. package/build/constants-internal.d.ts +0 -26
  37. package/build/constants.d.ts +0 -53
  38. package/build/deck/get-data-filter-extension-props.d.ts +0 -18
  39. package/build/deck/index.d.ts +0 -1
  40. package/build/filters/Filter.d.ts +0 -25
  41. package/build/filters/FilterTypes.d.ts +0 -3
  42. package/build/filters/geosjonFeatures.d.ts +0 -8
  43. package/build/filters/index.d.ts +0 -6
  44. package/build/filters/tileFeatures.d.ts +0 -21
  45. package/build/filters/tileFeaturesGeometries.d.ts +0 -13
  46. package/build/filters/tileFeaturesRaster.d.ts +0 -16
  47. package/build/filters/tileFeaturesSpatialIndex.d.ts +0 -10
  48. package/build/filters.d.ts +0 -39
  49. package/build/geo.d.ts +0 -19
  50. package/build/index.d.ts +0 -16
  51. package/build/models/common.d.ts +0 -28
  52. package/build/models/index.d.ts +0 -3
  53. package/build/models/model.d.ts +0 -37
  54. package/build/operations/aggregation.d.ts +0 -8
  55. package/build/operations/applySorting.d.ts +0 -20
  56. package/build/operations/groupBy.d.ts +0 -15
  57. package/build/operations/groupByDate.d.ts +0 -11
  58. package/build/operations/histogram.d.ts +0 -13
  59. package/build/operations/index.d.ts +0 -6
  60. package/build/operations/scatterPlot.d.ts +0 -14
  61. package/build/sources/base-source.d.ts +0 -4
  62. package/build/sources/boundary-query-source.d.ts +0 -10
  63. package/build/sources/boundary-table-source.d.ts +0 -8
  64. package/build/sources/h3-query-source.d.ts +0 -5
  65. package/build/sources/h3-table-source.d.ts +0 -5
  66. package/build/sources/h3-tileset-source.d.ts +0 -5
  67. package/build/sources/index.d.ts +0 -26
  68. package/build/sources/quadbin-query-source.d.ts +0 -5
  69. package/build/sources/quadbin-table-source.d.ts +0 -5
  70. package/build/sources/quadbin-tileset-source.d.ts +0 -5
  71. package/build/sources/raster-source.d.ts +0 -5
  72. package/build/sources/types.d.ts +0 -366
  73. package/build/sources/vector-query-source.d.ts +0 -5
  74. package/build/sources/vector-table-source.d.ts +0 -5
  75. package/build/sources/vector-tileset-source.d.ts +0 -5
  76. package/build/spatial-index.d.ts +0 -14
  77. package/build/types-internal.d.ts +0 -56
  78. package/build/types.d.ts +0 -148
  79. package/build/utils/dateUtils.d.ts +0 -10
  80. package/build/utils/getTileFormat.d.ts +0 -3
  81. package/build/utils/makeIntervalComplete.d.ts +0 -2
  82. package/build/utils/transformTileCoordsToWGS84.d.ts +0 -8
  83. package/build/utils/transformToTileCoords.d.ts +0 -9
  84. package/build/utils.d.ts +0 -32
  85. package/build/widget-sources/index.d.ts +0 -7
  86. package/build/widget-sources/types.d.ts +0 -160
  87. package/build/widget-sources/widget-query-source.d.ts +0 -34
  88. package/build/widget-sources/widget-raster-source.d.ts +0 -11
  89. package/build/widget-sources/widget-remote-source.d.ts +0 -21
  90. package/build/widget-sources/widget-source.d.ts +0 -74
  91. package/build/widget-sources/widget-table-source.d.ts +0 -34
  92. package/build/widget-sources/widget-tileset-source.d.ts +0 -75
  93. package/src/filters/tileFeaturesRaster.ts +0 -111
  94. package/src/widget-sources/widget-raster-source.ts +0 -14
@@ -1,366 +0,0 @@
1
- import type { Feature } from 'geojson';
2
- import { Filters, Format, QueryParameters } from '../types.js';
3
- import { MapInstantiation } from '../types-internal.js';
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
- * @privateRemarks 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, number, number, 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.js';
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.js';
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/index.js';
2
- import type { SourceOptions, TilesetSourceOptions, TilejsonResult } from './types.js';
3
- export type VectorTilesetSourceOptions = SourceOptions & TilesetSourceOptions;
4
- export type VectorTilesetSourceResponse = TilejsonResult & WidgetTilesetSourceResult;
5
- export declare const vectorTilesetSource: (options: VectorTilesetSourceOptions) => Promise<VectorTilesetSourceResponse>;
@@ -1,14 +0,0 @@
1
- import type { ModelSource } from './models/model.js';
2
- import type { AggregationOptions } from './sources/types.js';
3
- import type { ViewState } from './widget-sources/index.js';
4
- export declare function getSpatialFiltersResolution(source: Partial<ModelSource & AggregationOptions>, viewState: ViewState): number | undefined;
5
- /**
6
- * Resolution conversion function. Takes a WebMercatorViewport and returns
7
- * a H3 resolution such that the screen space size of the hexagons is
8
- * "similar" to the given tileSize on screen. Intended for use with deck.gl.
9
- * @internal
10
- */
11
- export declare function _getHexagonResolution(viewport: {
12
- zoom: number;
13
- latitude: number;
14
- }, tileSize: number): number;
@@ -1,56 +0,0 @@
1
- /******************************************************************************
2
- * COMMON
3
- */
4
- import { Format } from './types.js';
5
- /** @internal */
6
- export type $TODO = any;
7
- /** @internal */
8
- export type $IntentionalAny = any;
9
- /******************************************************************************
10
- * MAP INSTANTIATION
11
- */
12
- /**
13
- * @privateRemarks 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
- * @privateRemarks Source: @deck.gl/carto
29
- * @internal
30
- */
31
- export interface SchemaField {
32
- name: string;
33
- type: SchemaFieldType;
34
- }
35
- /**
36
- * @privateRemarks 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
- * @privateRemarks 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,148 +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
- /** @privateRemarks Source: @deck.gl/carto */
8
- export type Format = 'json' | 'geojson' | 'tilejson';
9
- /** @privateRemarks 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
- * @privateRemarks 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
- 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 */
56
- export type Raster = {
57
- blockSize: number;
58
- cells: {
59
- numericProps: BinaryFeature['numericProps'];
60
- properties: BinaryFeature['properties'];
61
- };
62
- };
63
- /******************************************************************************
64
- * AGGREGATION
65
- */
66
- /**
67
- * Enum for the different types of aggregations available for widgets.
68
- *
69
- * @privateRemarks Source: @carto/constants
70
- * @privateRemarks Converted from enum to type union, for improved declarative API.
71
- */
72
- export type AggregationType = 'count' | 'avg' | 'min' | 'max' | 'sum' | 'custom';
73
- /******************************************************************************
74
- * FILTERS
75
- */
76
- /** @privateRemarks Source: @carto/react-api */
77
- export type SpatialFilter = Polygon | MultiPolygon;
78
- /** @privateRemarks Source: @deck.gl/carto */
79
- export interface Filters {
80
- [column: string]: Filter;
81
- }
82
- /** @privateRemarks Source: @carto/react-api, @deck.gl/carto */
83
- export interface Filter {
84
- [FilterType.IN]?: {
85
- owner?: string;
86
- values: number[] | string[];
87
- };
88
- /** [a, b] both are included. */
89
- [FilterType.BETWEEN]?: {
90
- owner?: string;
91
- values: number[][];
92
- };
93
- /** [a, b) a is included, b is not. */
94
- [FilterType.CLOSED_OPEN]?: {
95
- owner?: string;
96
- values: number[][];
97
- };
98
- [FilterType.TIME]?: {
99
- owner?: string;
100
- values: number[][];
101
- };
102
- [FilterType.STRING_SEARCH]?: {
103
- owner?: string;
104
- values: string[];
105
- params?: StringSearchOptions;
106
- };
107
- }
108
- /** @privateRemarks Source: @carto/react-core */
109
- export type FilterLogicalOperator = 'and' | 'or';
110
- /**
111
- * Type for minimum or maximum value of an interval. Values 'null' and
112
- * 'undefined' are intentionally allowed, and represent an unbounded value.
113
- */
114
- export type FilterIntervalExtremum = number | null | undefined;
115
- export type FilterInterval = [FilterIntervalExtremum, FilterIntervalExtremum];
116
- export type FilterIntervalComplete = [number, number];
117
- export type StringSearchOptions = {
118
- useRegExp?: boolean;
119
- mustStart?: boolean;
120
- mustEnd?: boolean;
121
- caseSensitive?: boolean;
122
- keepSpecialCharacters?: boolean;
123
- };
124
- /******************************************************************************
125
- * GROUPING
126
- */
127
- /**
128
- * Defines a step size increment for use with {@link TimeSeriesRequestOptions}.
129
- *
130
- * @privateRemarks Source: @carto/react-core
131
- */
132
- export type GroupDateType = 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second';
133
- /******************************************************************************
134
- * SORTING
135
- */
136
- export type SortDirection = 'asc' | 'desc';
137
- export type SortColumnType = 'number' | 'string' | 'date';
138
- /******************************************************************************
139
- * SQL QUERY PARAMETERS
140
- */
141
- /** @privateRemarks Source: @deck.gl/carto */
142
- export type QueryParameterValue = string | number | boolean | Array<QueryParameterValue> | object;
143
- /** @privateRemarks Source: @deck.gl/carto */
144
- export type NamedQueryParameter = Record<string, QueryParameterValue>;
145
- /** @privateRemarks Source: @deck.gl/carto */
146
- export type PositionalQueryParameter = QueryParameterValue[];
147
- /** @privateRemarks Source: @deck.gl/carto */
148
- 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,3 +0,0 @@
1
- import { TileFormat } from '../constants.js';
2
- import { Tilejson } from '../sources/types.js';
3
- export declare function getTileFormat(tilejson: Tilejson): TileFormat;
@@ -1,2 +0,0 @@
1
- import { FilterInterval, FilterIntervalComplete } from '../types.js';
2
- export declare function makeIntervalComplete(intervals: FilterInterval[]): FilterIntervalComplete[];
@@ -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
- * @privateRemarks Source: @carto/react-widgets
13
- * @internal
14
- */
15
- export declare function normalizeObjectKeys<T, R extends Row<T>>(el: R): R;
16
- /** @privateRemarks Source: @carto/react-core */
17
- export declare function assert(condition: unknown, message: string): asserts condition;
18
- /**
19
- * @privateRemarks 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 {};
@@ -1,7 +0,0 @@
1
- export * from './widget-source.js';
2
- export * from './widget-query-source.js';
3
- export * from './widget-raster-source.js';
4
- export * from './widget-remote-source.js';
5
- export * from './widget-table-source.js';
6
- export * from './widget-tileset-source.js';
7
- export * from './types.js';