@carto/api-client 0.5.0-alpha.3 → 0.5.0-alpha.5

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 (131) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/api-client.cjs +3332 -3100
  3. package/build/api-client.d.cts +1373 -0
  4. package/build/api-client.d.ts +1373 -0
  5. package/build/api-client.js +1712 -0
  6. package/build/chunk-V3E7BKVR.js +2063 -0
  7. package/build/worker.d.ts +2 -0
  8. package/build/worker.js +25 -0
  9. package/package.json +51 -45
  10. package/src/api/carto-api-error.ts +1 -1
  11. package/src/api/query.ts +5 -5
  12. package/src/api/request-with-parameters.ts +6 -6
  13. package/src/client.ts +3 -3
  14. package/src/constants-internal.ts +5 -11
  15. package/src/constants.ts +6 -6
  16. package/src/deck/get-data-filter-extension-props.ts +146 -0
  17. package/src/deck/index.ts +1 -0
  18. package/src/filters/Filter.ts +18 -8
  19. package/src/filters/FilterTypes.ts +2 -2
  20. package/src/filters/geosjonFeatures.ts +2 -2
  21. package/src/filters/tileFeatures.ts +19 -41
  22. package/src/filters.ts +4 -4
  23. package/src/geo.ts +12 -14
  24. package/src/global.d.ts +3 -8
  25. package/src/index.ts +1 -0
  26. package/src/models/common.ts +9 -7
  27. package/src/models/model.ts +3 -4
  28. package/src/operations/aggregation.ts +5 -5
  29. package/src/operations/applySorting.ts +4 -4
  30. package/src/operations/groupBy.ts +4 -4
  31. package/src/operations/groupByDate.ts +1 -1
  32. package/src/operations/histogram.ts +4 -4
  33. package/src/operations/scatterPlot.ts +4 -4
  34. package/src/sources/base-source.ts +8 -8
  35. package/src/sources/boundary-query-source.ts +2 -2
  36. package/src/sources/boundary-table-source.ts +2 -2
  37. package/src/sources/h3-query-source.ts +7 -5
  38. package/src/sources/h3-table-source.ts +7 -5
  39. package/src/sources/h3-tileset-source.ts +12 -5
  40. package/src/sources/index.ts +26 -26
  41. package/src/sources/quadbin-query-source.ts +7 -5
  42. package/src/sources/quadbin-table-source.ts +7 -5
  43. package/src/sources/quadbin-tileset-source.ts +12 -5
  44. package/src/sources/raster-source.ts +7 -16
  45. package/src/sources/types.ts +10 -4
  46. package/src/sources/vector-query-source.ts +2 -3
  47. package/src/sources/vector-table-source.ts +2 -3
  48. package/src/sources/vector-tileset-source.ts +13 -6
  49. package/src/spatial-index.ts +4 -4
  50. package/src/types-internal.ts +5 -5
  51. package/src/types.ts +15 -21
  52. package/src/utils/makeIntervalComplete.ts +1 -1
  53. package/src/utils.ts +3 -3
  54. package/src/widget-sources/index.ts +1 -1
  55. package/src/widget-sources/types.ts +5 -3
  56. package/src/widget-sources/widget-query-source.ts +6 -2
  57. package/src/widget-sources/widget-remote-source.ts +66 -18
  58. package/src/widget-sources/widget-source.ts +0 -28
  59. package/src/widget-sources/widget-table-source.ts +6 -2
  60. package/src/widget-sources/widget-tileset-source.ts +130 -90
  61. package/src/widget-sources/widget-tileset-worker-source.ts +238 -0
  62. package/src/workers/constants.ts +13 -0
  63. package/src/workers/types.ts +20 -0
  64. package/src/workers/utils.ts +33 -0
  65. package/src/workers/widget-tileset-worker.ts +36 -0
  66. package/build/api/carto-api-error.d.ts +0 -26
  67. package/build/api/endpoints.d.ts +0 -24
  68. package/build/api/index.d.ts +0 -5
  69. package/build/api/query.d.ts +0 -3
  70. package/build/api/request-with-parameters.d.ts +0 -10
  71. package/build/api-client.cjs.map +0 -1
  72. package/build/api-client.modern.js +0 -3304
  73. package/build/api-client.modern.js.map +0 -1
  74. package/build/client.d.ts +0 -14
  75. package/build/constants-internal.d.ts +0 -26
  76. package/build/constants.d.ts +0 -53
  77. package/build/filters/Filter.d.ts +0 -13
  78. package/build/filters/FilterTypes.d.ts +0 -3
  79. package/build/filters/geosjonFeatures.d.ts +0 -8
  80. package/build/filters/index.d.ts +0 -6
  81. package/build/filters/tileFeatures.d.ts +0 -21
  82. package/build/filters/tileFeaturesGeometries.d.ts +0 -13
  83. package/build/filters/tileFeaturesRaster.d.ts +0 -16
  84. package/build/filters/tileFeaturesSpatialIndex.d.ts +0 -10
  85. package/build/filters.d.ts +0 -39
  86. package/build/geo.d.ts +0 -19
  87. package/build/index.d.ts +0 -15
  88. package/build/models/common.d.ts +0 -27
  89. package/build/models/index.d.ts +0 -3
  90. package/build/models/model.d.ts +0 -37
  91. package/build/operations/aggregation.d.ts +0 -8
  92. package/build/operations/applySorting.d.ts +0 -20
  93. package/build/operations/groupBy.d.ts +0 -15
  94. package/build/operations/groupByDate.d.ts +0 -11
  95. package/build/operations/histogram.d.ts +0 -13
  96. package/build/operations/index.d.ts +0 -6
  97. package/build/operations/scatterPlot.d.ts +0 -14
  98. package/build/sources/base-source.d.ts +0 -4
  99. package/build/sources/boundary-query-source.d.ts +0 -10
  100. package/build/sources/boundary-table-source.d.ts +0 -8
  101. package/build/sources/h3-query-source.d.ts +0 -5
  102. package/build/sources/h3-table-source.d.ts +0 -5
  103. package/build/sources/h3-tileset-source.d.ts +0 -5
  104. package/build/sources/index.d.ts +0 -26
  105. package/build/sources/quadbin-query-source.d.ts +0 -5
  106. package/build/sources/quadbin-table-source.d.ts +0 -5
  107. package/build/sources/quadbin-tileset-source.d.ts +0 -5
  108. package/build/sources/raster-source.d.ts +0 -5
  109. package/build/sources/types.d.ts +0 -366
  110. package/build/sources/vector-query-source.d.ts +0 -5
  111. package/build/sources/vector-table-source.d.ts +0 -5
  112. package/build/sources/vector-tileset-source.d.ts +0 -5
  113. package/build/spatial-index.d.ts +0 -14
  114. package/build/types-internal.d.ts +0 -56
  115. package/build/types.d.ts +0 -148
  116. package/build/utils/dateUtils.d.ts +0 -10
  117. package/build/utils/getTileFormat.d.ts +0 -3
  118. package/build/utils/makeIntervalComplete.d.ts +0 -2
  119. package/build/utils/transformTileCoordsToWGS84.d.ts +0 -8
  120. package/build/utils/transformToTileCoords.d.ts +0 -9
  121. package/build/utils.d.ts +0 -32
  122. package/build/widget-sources/index.d.ts +0 -7
  123. package/build/widget-sources/types.d.ts +0 -158
  124. package/build/widget-sources/widget-query-source.d.ts +0 -33
  125. package/build/widget-sources/widget-raster-source.d.ts +0 -11
  126. package/build/widget-sources/widget-remote-source.d.ts +0 -18
  127. package/build/widget-sources/widget-source.d.ts +0 -74
  128. package/build/widget-sources/widget-table-source.d.ts +0 -33
  129. package/build/widget-sources/widget-tileset-source.d.ts +0 -77
  130. package/src/filters/tileFeaturesRaster.ts +0 -111
  131. package/src/widget-sources/widget-raster-source.ts +0 -14
@@ -2,17 +2,19 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- import {getTileFormat} from '../utils/getTileFormat';
5
+ import {getTileFormat} from '../utils/getTileFormat.js';
6
6
  import {
7
7
  WidgetTilesetSource,
8
8
  WidgetTilesetSourceResult,
9
- } from '../widget-sources';
10
- import {baseSource} from './base-source';
9
+ WidgetTilesetWorkerSource,
10
+ } from '../widget-sources/index.js';
11
+ import {isModuleWorkerSupported} from '../workers/utils.js';
12
+ import {baseSource} from './base-source.js';
11
13
  import type {
12
14
  SourceOptions,
13
15
  TilejsonResult,
14
16
  TilesetSourceOptions,
15
- } from './types';
17
+ } from './types.js';
16
18
 
17
19
  export type QuadbinTilesetSourceOptions = SourceOptions & TilesetSourceOptions;
18
20
  type UrlParameters = {name: string};
@@ -26,10 +28,15 @@ export const quadbinTilesetSource = async function (
26
28
  const {tableName, spatialDataColumn = 'quadbin'} = options;
27
29
  const urlParameters: UrlParameters = {name: tableName};
28
30
 
31
+ const WidgetSourceClass =
32
+ options.widgetSourceWorker !== false && isModuleWorkerSupported()
33
+ ? WidgetTilesetWorkerSource
34
+ : WidgetTilesetSource;
35
+
29
36
  return baseSource<UrlParameters>('tileset', options, urlParameters).then(
30
37
  (result) => ({
31
38
  ...(result as TilejsonResult),
32
- widgetSource: new WidgetTilesetSource({
39
+ widgetSource: new WidgetSourceClass({
33
40
  ...options,
34
41
  tileFormat: getTileFormat(result as TilejsonResult),
35
42
  spatialDataColumn,
@@ -2,15 +2,13 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- import {getTileFormat} from '../utils/getTileFormat';
6
- import {WidgetRasterSource, WidgetRasterSourceResult} from '../widget-sources';
7
- import {baseSource} from './base-source';
5
+ import {baseSource} from './base-source.js';
8
6
  import type {
9
7
  FilterOptions,
10
8
  SourceOptions,
11
9
  TilejsonResult,
12
10
  TilesetSourceOptions,
13
- } from './types';
11
+ } from './types.js';
14
12
 
15
13
  export type RasterSourceOptions = SourceOptions &
16
14
  TilesetSourceOptions &
@@ -20,7 +18,7 @@ type UrlParameters = {
20
18
  filters?: Record<string, unknown>;
21
19
  };
22
20
 
23
- export type RasterSourceResponse = TilejsonResult & WidgetRasterSourceResult;
21
+ export type RasterSourceResponse = TilejsonResult;
24
22
 
25
23
  export const rasterSource = async function (
26
24
  options: RasterSourceOptions
@@ -31,16 +29,9 @@ export const rasterSource = async function (
31
29
  urlParameters.filters = filters;
32
30
  }
33
31
 
34
- return baseSource<UrlParameters>('raster', options, urlParameters).then(
35
- (result) => ({
36
- ...(result as TilejsonResult),
37
- widgetSource: new WidgetRasterSource({
38
- ...options,
39
- tileFormat: getTileFormat(result as TilejsonResult),
40
- spatialDataColumn: 'quadbin',
41
- spatialDataType: 'quadbin',
42
- rasterMetadata: (result as TilejsonResult).raster_metadata!,
43
- }),
44
- })
32
+ return baseSource<UrlParameters>(
33
+ 'raster',
34
+ options,
35
+ urlParameters
45
36
  ) as Promise<RasterSourceResponse>;
46
37
  };
@@ -3,8 +3,8 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import type {Feature} from 'geojson';
6
- import {Filters, Format, QueryParameters} from '../types';
7
- import {MapInstantiation} from '../types-internal';
6
+ import {Filters, Format, QueryParameters} from '../types.js';
7
+ import {MapInstantiation} from '../types-internal.js';
8
8
 
9
9
  export type SourceRequiredOptions = {
10
10
  /** Carto platform access token. */
@@ -191,6 +191,12 @@ 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
+ widgetSourceWorker?: boolean;
194
200
  };
195
201
 
196
202
  export type ColumnsOption = {
@@ -208,7 +214,7 @@ export type SpatialDataType = 'geo' | 'h3' | 'quadbin';
208
214
  * Strategy used for covering spatial filter geometry with spatial indexes.
209
215
  * See https://docs.carto.com/data-and-analysis/analytics-toolbox-for-bigquery/sql-reference/quadbin#quadbin_polyfill_mode
210
216
  * or https://docs.carto.com/data-and-analysis/analytics-toolbox-for-bigquery/sql-reference/h3#h3_polyfill_mode for more information.
211
- * @internalRemarks Source: cloud-native maps-api
217
+ * @privateRemarks Source: cloud-native maps-api
212
218
  * */
213
219
  export type SpatialFilterPolyfillMode = 'center' | 'intersects' | 'contains';
214
220
 
@@ -373,7 +379,7 @@ export type RasterMetadataBand = {
373
379
  /**
374
380
  * Default color mapping for unique values (or if coloprinterp is `palette`)
375
381
  */
376
- colortable?: Record<string, [number, number, number, number]>;
382
+ colortable?: Record<string, number[]>;
377
383
 
378
384
  /**
379
385
  * No value representation.
@@ -2,7 +2,6 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- /* eslint-disable camelcase */
6
5
  import {
7
6
  DEFAULT_GEO_COLUMN,
8
7
  DEFAULT_TILE_RESOLUTION,
@@ -11,7 +10,7 @@ import {
11
10
  WidgetQuerySource,
12
11
  WidgetQuerySourceResult,
13
12
  } from '../widget-sources/index.js';
14
- import {baseSource} from './base-source';
13
+ import {baseSource} from './base-source.js';
15
14
  import type {
16
15
  FilterOptions,
17
16
  SourceOptions,
@@ -19,7 +18,7 @@ import type {
19
18
  SpatialDataType,
20
19
  TilejsonResult,
21
20
  ColumnsOption,
22
- } from './types';
21
+ } from './types.js';
23
22
 
24
23
  export type VectorQuerySourceOptions = SourceOptions &
25
24
  QuerySourceOptions &
@@ -2,7 +2,6 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- /* eslint-disable camelcase */
6
5
  import {
7
6
  DEFAULT_GEO_COLUMN,
8
7
  DEFAULT_TILE_RESOLUTION,
@@ -11,7 +10,7 @@ import {
11
10
  WidgetTableSource,
12
11
  WidgetTableSourceResult,
13
12
  } from '../widget-sources/index.js';
14
- import {baseSource} from './base-source';
13
+ import {baseSource} from './base-source.js';
15
14
  import type {
16
15
  FilterOptions,
17
16
  ColumnsOption,
@@ -19,7 +18,7 @@ import type {
19
18
  SpatialDataType,
20
19
  TableSourceOptions,
21
20
  TilejsonResult,
22
- } from './types';
21
+ } from './types.js';
23
22
 
24
23
  export type VectorTableSourceOptions = SourceOptions &
25
24
  TableSourceOptions &
@@ -2,18 +2,20 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- import {DEFAULT_GEO_COLUMN} from '../constants-internal';
6
- import {getTileFormat} from '../utils/getTileFormat';
5
+ import {DEFAULT_GEO_COLUMN} from '../constants-internal.js';
6
+ import {getTileFormat} from '../utils/getTileFormat.js';
7
7
  import {
8
8
  WidgetTilesetSource,
9
9
  WidgetTilesetSourceResult,
10
- } from '../widget-sources';
11
- import {baseSource} from './base-source';
10
+ WidgetTilesetWorkerSource,
11
+ } from '../widget-sources/index.js';
12
+ import {isModuleWorkerSupported} from '../workers/utils.js';
13
+ import {baseSource} from './base-source.js';
12
14
  import type {
13
15
  SourceOptions,
14
16
  TilesetSourceOptions,
15
17
  TilejsonResult,
16
- } from './types';
18
+ } from './types.js';
17
19
 
18
20
  export type VectorTilesetSourceOptions = SourceOptions & TilesetSourceOptions;
19
21
  type UrlParameters = {name: string};
@@ -27,10 +29,15 @@ export const vectorTilesetSource = async function (
27
29
  const {tableName, spatialDataColumn = DEFAULT_GEO_COLUMN} = options;
28
30
  const urlParameters: UrlParameters = {name: tableName};
29
31
 
32
+ const WidgetSourceClass =
33
+ options.widgetSourceWorker !== false && isModuleWorkerSupported()
34
+ ? WidgetTilesetWorkerSource
35
+ : WidgetTilesetSource;
36
+
30
37
  return baseSource<UrlParameters>('tileset', options, urlParameters).then(
31
38
  (result) => ({
32
39
  ...(result as TilejsonResult),
33
- widgetSource: new WidgetTilesetSource({
40
+ widgetSource: new WidgetSourceClass({
34
41
  ...options,
35
42
  tileFormat: getTileFormat(result as TilejsonResult),
36
43
  spatialDataColumn,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  DEFAULT_AGGREGATION_RES_LEVEL_H3,
3
3
  DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN,
4
- } from './constants-internal';
5
- import type {ModelSource} from './models/model';
6
- import type {AggregationOptions} from './sources/types';
7
- import type {ViewState} from './widget-sources';
4
+ } from './constants-internal.js';
5
+ import type {ModelSource} from './models/model.js';
6
+ import type {AggregationOptions} from './sources/types.js';
7
+ import type {ViewState} from './widget-sources/index.js';
8
8
 
9
9
  const DEFAULT_TILE_SIZE = 512;
10
10
  const QUADBIN_ZOOM_MAX_OFFSET = 4;
@@ -2,7 +2,7 @@
2
2
  * COMMON
3
3
  */
4
4
 
5
- import {Format} from './types';
5
+ import {Format} from './types.js';
6
6
 
7
7
  /** @internal */
8
8
  export type $TODO = any;
@@ -15,7 +15,7 @@ export type $IntentionalAny = any;
15
15
  */
16
16
 
17
17
  /**
18
- * @internalRemarks Source: @deck.gl/carto
18
+ * @privateRemarks Source: @deck.gl/carto
19
19
  * @internal
20
20
  */
21
21
  export enum SchemaFieldType {
@@ -31,7 +31,7 @@ export enum SchemaFieldType {
31
31
  }
32
32
 
33
33
  /**
34
- * @internalRemarks Source: @deck.gl/carto
34
+ * @privateRemarks Source: @deck.gl/carto
35
35
  * @internal
36
36
  */
37
37
  export interface SchemaField {
@@ -40,7 +40,7 @@ export interface SchemaField {
40
40
  }
41
41
 
42
42
  /**
43
- * @internalRemarks Source: @deck.gl/carto
43
+ * @privateRemarks Source: @deck.gl/carto
44
44
  * @internal
45
45
  */
46
46
  export interface MapInstantiation extends MapInstantiationFormats {
@@ -50,7 +50,7 @@ export interface MapInstantiation extends MapInstantiationFormats {
50
50
  }
51
51
 
52
52
  /**
53
- * @internalRemarks Source: @deck.gl/carto
53
+ * @privateRemarks Source: @deck.gl/carto
54
54
  * @internal
55
55
  */
56
56
  type MapInstantiationFormats = Record<
package/src/types.ts CHANGED
@@ -6,10 +6,10 @@ import type {BinaryFeature, BinaryFeatureCollection} from '@loaders.gl/schema';
6
6
  * MAPS AND TILES
7
7
  */
8
8
 
9
- /** @internalRemarks Source: @deck.gl/carto */
9
+ /** @privateRemarks Source: @deck.gl/carto */
10
10
  export type Format = 'json' | 'geojson' | 'tilejson';
11
11
 
12
- /** @internalRemarks Source: @carto/constants, @deck.gl/carto */
12
+ /** @privateRemarks Source: @carto/constants, @deck.gl/carto */
13
13
  export type MapType = 'boundary' | 'query' | 'table' | 'tileset' | 'raster';
14
14
 
15
15
  /**
@@ -23,7 +23,7 @@ export type Viewport = [number, number, number, number];
23
23
  * required for local widget calculations. Deeper dependencies on deck.gl
24
24
  * APIs should be minimized within this library: @deck.gl/carto depends
25
25
  * on the API client, not the other way around.
26
- * @internalRemarks Source: @deck.gl/geo-layers
26
+ * @privateRemarks Source: @deck.gl/geo-layers
27
27
  */
28
28
  export type Tile = {
29
29
  index: {x: number; y: number; z: number};
@@ -40,13 +40,7 @@ export type SpatialIndexTile = Tile & {
40
40
  data?: (Feature & {id: bigint})[];
41
41
  };
42
42
 
43
- export type RasterTile = Tile & {
44
- id: string;
45
- index: {q: bigint; i: string};
46
- data?: Raster;
47
- };
48
-
49
- /** @internalRemarks Source: @deck.gl/carto */
43
+ /** @privateRemarks Source: @deck.gl/carto */
50
44
  export type Raster = {
51
45
  blockSize: number;
52
46
  cells: {
@@ -62,8 +56,8 @@ export type Raster = {
62
56
  /**
63
57
  * Enum for the different types of aggregations available for widgets.
64
58
  *
65
- * @internalRemarks Source: @carto/constants
66
- * @internalRemarks Converted from enum to type union, for improved declarative API.
59
+ * @privateRemarks Source: @carto/constants
60
+ * @privateRemarks Converted from enum to type union, for improved declarative API.
67
61
  */
68
62
  export type AggregationType =
69
63
  | 'count'
@@ -77,15 +71,15 @@ export type AggregationType =
77
71
  * FILTERS
78
72
  */
79
73
 
80
- /** @internalRemarks Source: @carto/react-api */
74
+ /** @privateRemarks Source: @carto/react-api */
81
75
  export type SpatialFilter = Polygon | MultiPolygon;
82
76
 
83
- /** @internalRemarks Source: @deck.gl/carto */
77
+ /** @privateRemarks Source: @deck.gl/carto */
84
78
  export interface Filters {
85
79
  [column: string]: Filter;
86
80
  }
87
81
 
88
- /** @internalRemarks Source: @carto/react-api, @deck.gl/carto */
82
+ /** @privateRemarks Source: @carto/react-api, @deck.gl/carto */
89
83
  export interface Filter {
90
84
  [FilterType.IN]?: {owner?: string; values: number[] | string[]};
91
85
  /** [a, b] both are included. */
@@ -100,7 +94,7 @@ export interface Filter {
100
94
  };
101
95
  }
102
96
 
103
- /** @internalRemarks Source: @carto/react-core */
97
+ /** @privateRemarks Source: @carto/react-core */
104
98
  export type FilterLogicalOperator = 'and' | 'or';
105
99
 
106
100
  /**
@@ -126,7 +120,7 @@ export type StringSearchOptions = {
126
120
  /**
127
121
  * Defines a step size increment for use with {@link TimeSeriesRequestOptions}.
128
122
  *
129
- * @internalRemarks Source: @carto/react-core
123
+ * @privateRemarks Source: @carto/react-core
130
124
  */
131
125
  export type GroupDateType =
132
126
  | 'year'
@@ -148,7 +142,7 @@ export type SortColumnType = 'number' | 'string' | 'date';
148
142
  * SQL QUERY PARAMETERS
149
143
  */
150
144
 
151
- /** @internalRemarks Source: @deck.gl/carto */
145
+ /** @privateRemarks Source: @deck.gl/carto */
152
146
  export type QueryParameterValue =
153
147
  | string
154
148
  | number
@@ -156,11 +150,11 @@ export type QueryParameterValue =
156
150
  | Array<QueryParameterValue>
157
151
  | object;
158
152
 
159
- /** @internalRemarks Source: @deck.gl/carto */
153
+ /** @privateRemarks Source: @deck.gl/carto */
160
154
  export type NamedQueryParameter = Record<string, QueryParameterValue>;
161
155
 
162
- /** @internalRemarks Source: @deck.gl/carto */
156
+ /** @privateRemarks Source: @deck.gl/carto */
163
157
  export type PositionalQueryParameter = QueryParameterValue[];
164
158
 
165
- /** @internalRemarks Source: @deck.gl/carto */
159
+ /** @privateRemarks Source: @deck.gl/carto */
166
160
  export type QueryParameters = NamedQueryParameter | PositionalQueryParameter;
@@ -1,4 +1,4 @@
1
- import {FilterInterval, FilterIntervalComplete} from '../types';
1
+ import {FilterInterval, FilterIntervalComplete} from '../types.js';
2
2
 
3
3
  export function makeIntervalComplete(
4
4
  intervals: FilterInterval[]
package/src/utils.ts CHANGED
@@ -39,7 +39,7 @@ type Row<T> = Record<string, T> | Record<string, T>[] | T[] | T;
39
39
  * Due to each data warehouse having its own behavior with columns,
40
40
  * we need to normalize them and transform every key to lowercase.
41
41
  *
42
- * @internalRemarks Source: @carto/react-widgets
42
+ * @privateRemarks Source: @carto/react-widgets
43
43
  * @internal
44
44
  */
45
45
  export function normalizeObjectKeys<T, R extends Row<T>>(el: R): R {
@@ -59,7 +59,7 @@ export function normalizeObjectKeys<T, R extends Row<T>>(el: R): R {
59
59
  ) as R;
60
60
  }
61
61
 
62
- /** @internalRemarks Source: @carto/react-core */
62
+ /** @privateRemarks Source: @carto/react-core */
63
63
  export function assert(condition: unknown, message: string): asserts condition {
64
64
  if (!condition) {
65
65
  throw new Error(message);
@@ -67,7 +67,7 @@ export function assert(condition: unknown, message: string): asserts condition {
67
67
  }
68
68
 
69
69
  /**
70
- * @internalRemarks Source: @carto/react-core
70
+ * @privateRemarks Source: @carto/react-core
71
71
  * @internal
72
72
  */
73
73
  export class InvalidColumnError extends Error {
@@ -1,7 +1,7 @@
1
1
  export * from './widget-source.js';
2
2
  export * from './widget-query-source.js';
3
- export * from './widget-raster-source.js';
4
3
  export * from './widget-remote-source.js';
5
4
  export * from './widget-table-source.js';
6
5
  export * from './widget-tileset-source.js';
6
+ export * from './widget-tileset-worker-source.js';
7
7
  export * from './types.js';
@@ -1,11 +1,11 @@
1
- import {SpatialFilterPolyfillMode, TileResolution} from '../sources/types';
1
+ import {SpatialFilterPolyfillMode, TileResolution} from '../sources/types.js';
2
2
  import {
3
+ Filters,
3
4
  GroupDateType,
4
5
  SortColumnType,
5
6
  SortDirection,
6
7
  SpatialFilter,
7
- } from '../types';
8
- import type {WidgetRemoteSource} from './widget-remote-source';
8
+ } from '../types.js';
9
9
 
10
10
  /******************************************************************************
11
11
  * WIDGET API REQUESTS
@@ -24,6 +24,8 @@ interface BaseRequestOptions {
24
24
  /** Required for table- and query-based spatial index sources (H3, Quadbin). */
25
25
  spatialIndexReferenceViewState?: ViewState;
26
26
  abortController?: AbortController;
27
+ /** Overrides source filters, if any. */
28
+ filters?: Filters;
27
29
  filterOwner?: string;
28
30
  }
29
31
 
@@ -8,6 +8,7 @@ import {
8
8
  WidgetRemoteSourceProps,
9
9
  } from './widget-remote-source.js';
10
10
  import {ModelSource} from '../models/model.js';
11
+ import {Filters} from '../types.js';
11
12
 
12
13
  type LayerQuerySourceOptions =
13
14
  | Omit<VectorQuerySourceOptions, 'filters'>
@@ -41,9 +42,12 @@ export type WidgetQuerySourceResult = {widgetSource: WidgetQuerySource};
41
42
  export class WidgetQuerySource extends WidgetRemoteSource<
42
43
  LayerQuerySourceOptions & WidgetRemoteSourceProps
43
44
  > {
44
- protected override getModelSource(owner: string): ModelSource {
45
+ protected override getModelSource(
46
+ filters: Filters | undefined,
47
+ filterOwner?: string
48
+ ): ModelSource {
45
49
  return {
46
- ...super._getModelSource(owner),
50
+ ...super._getModelSource(filters, filterOwner),
47
51
  type: 'query',
48
52
  data: this.props.sqlQuery,
49
53
  queryParameters: this.props.queryParameters,