@carto/api-client 0.5.0-alpha.0 → 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.
Files changed (127) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/build/api-client.cjs +3178 -3200
  3. package/build/api-client.cjs.map +1 -1
  4. package/build/api-client.d.cts +1389 -0
  5. package/build/api-client.d.ts +1389 -0
  6. package/build/api-client.js +3674 -0
  7. package/build/api-client.js.map +1 -0
  8. package/build/worker.d.ts +2 -0
  9. package/build/worker.js +1949 -0
  10. package/build/worker.js.map +1 -0
  11. package/package.json +60 -45
  12. package/src/api/carto-api-error.ts +1 -1
  13. package/src/api/query.ts +5 -5
  14. package/src/api/request-with-parameters.ts +6 -6
  15. package/src/client.ts +3 -3
  16. package/src/constants-internal.ts +5 -11
  17. package/src/constants.ts +6 -6
  18. package/src/deck/get-data-filter-extension-props.ts +146 -0
  19. package/src/deck/index.ts +1 -0
  20. package/src/filters/Filter.ts +18 -8
  21. package/src/filters/FilterTypes.ts +2 -2
  22. package/src/filters/geosjonFeatures.ts +2 -2
  23. package/src/filters/tileFeatures.ts +12 -17
  24. package/src/filters.ts +4 -4
  25. package/src/geo.ts +12 -14
  26. package/src/global.d.ts +3 -8
  27. package/src/index.ts +3 -0
  28. package/src/models/common.ts +11 -9
  29. package/src/models/model.ts +3 -4
  30. package/src/operations/aggregation.ts +5 -5
  31. package/src/operations/applySorting.ts +4 -4
  32. package/src/operations/groupBy.ts +4 -4
  33. package/src/operations/groupByDate.ts +1 -1
  34. package/src/operations/histogram.ts +4 -4
  35. package/src/operations/scatterPlot.ts +4 -4
  36. package/src/sources/base-source.ts +8 -8
  37. package/src/sources/boundary-query-source.ts +3 -2
  38. package/src/sources/boundary-table-source.ts +3 -2
  39. package/src/sources/h3-query-source.ts +14 -8
  40. package/src/sources/h3-table-source.ts +14 -8
  41. package/src/sources/h3-tileset-source.ts +4 -4
  42. package/src/sources/index.ts +28 -26
  43. package/src/sources/quadbin-query-source.ts +14 -8
  44. package/src/sources/quadbin-table-source.ts +13 -8
  45. package/src/sources/quadbin-tileset-source.ts +4 -4
  46. package/src/sources/raster-source.ts +2 -2
  47. package/src/sources/types.ts +9 -3
  48. package/src/sources/vector-query-source.ts +9 -5
  49. package/src/sources/vector-table-source.ts +9 -5
  50. package/src/sources/vector-tileset-source.ts +5 -5
  51. package/src/spatial-index.ts +12 -10
  52. package/src/types-internal.ts +5 -5
  53. package/src/types.ts +15 -15
  54. package/src/utils/makeIntervalComplete.ts +1 -1
  55. package/src/utils.ts +3 -3
  56. package/src/widget-sources/index.ts +1 -0
  57. package/src/widget-sources/types.ts +6 -4
  58. package/src/widget-sources/widget-query-source.ts +6 -2
  59. package/src/widget-sources/widget-remote-source.ts +67 -26
  60. package/src/widget-sources/widget-source.ts +10 -25
  61. package/src/widget-sources/widget-table-source.ts +6 -2
  62. package/src/widget-sources/widget-tileset-source-impl.ts +417 -0
  63. package/src/widget-sources/widget-tileset-source.ts +201 -289
  64. package/src/workers/constants.ts +13 -0
  65. package/src/workers/types.ts +19 -0
  66. package/src/workers/widget-tileset-worker.ts +40 -0
  67. package/build/api/carto-api-error.d.ts +0 -26
  68. package/build/api/endpoints.d.ts +0 -24
  69. package/build/api/index.d.ts +0 -5
  70. package/build/api/query.d.ts +0 -3
  71. package/build/api/request-with-parameters.d.ts +0 -10
  72. package/build/api-client.modern.js +0 -3553
  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 -20
  82. package/build/filters/tileFeaturesGeometries.d.ts +0 -13
  83. package/build/filters/tileFeaturesSpatialIndex.d.ts +0 -10
  84. package/build/filters.d.ts +0 -39
  85. package/build/geo.d.ts +0 -19
  86. package/build/index.d.ts +0 -14
  87. package/build/models/common.d.ts +0 -27
  88. package/build/models/index.d.ts +0 -3
  89. package/build/models/model.d.ts +0 -37
  90. package/build/operations/aggregation.d.ts +0 -8
  91. package/build/operations/applySorting.d.ts +0 -20
  92. package/build/operations/groupBy.d.ts +0 -15
  93. package/build/operations/groupByDate.d.ts +0 -11
  94. package/build/operations/histogram.d.ts +0 -13
  95. package/build/operations/index.d.ts +0 -6
  96. package/build/operations/scatterPlot.d.ts +0 -14
  97. package/build/sources/base-source.d.ts +0 -4
  98. package/build/sources/boundary-query-source.d.ts +0 -10
  99. package/build/sources/boundary-table-source.d.ts +0 -8
  100. package/build/sources/h3-query-source.d.ts +0 -5
  101. package/build/sources/h3-table-source.d.ts +0 -5
  102. package/build/sources/h3-tileset-source.d.ts +0 -5
  103. package/build/sources/index.d.ts +0 -26
  104. package/build/sources/quadbin-query-source.d.ts +0 -5
  105. package/build/sources/quadbin-table-source.d.ts +0 -5
  106. package/build/sources/quadbin-tileset-source.d.ts +0 -5
  107. package/build/sources/raster-source.d.ts +0 -4
  108. package/build/sources/types.d.ts +0 -366
  109. package/build/sources/vector-query-source.d.ts +0 -5
  110. package/build/sources/vector-table-source.d.ts +0 -5
  111. package/build/sources/vector-tileset-source.d.ts +0 -5
  112. package/build/spatial-index.d.ts +0 -8
  113. package/build/types-internal.d.ts +0 -56
  114. package/build/types.d.ts +0 -140
  115. package/build/utils/dateUtils.d.ts +0 -10
  116. package/build/utils/getTileFormat.d.ts +0 -3
  117. package/build/utils/makeIntervalComplete.d.ts +0 -2
  118. package/build/utils/transformTileCoordsToWGS84.d.ts +0 -8
  119. package/build/utils/transformToTileCoords.d.ts +0 -9
  120. package/build/utils.d.ts +0 -32
  121. package/build/widget-sources/index.d.ts +0 -5
  122. package/build/widget-sources/types.d.ts +0 -158
  123. package/build/widget-sources/widget-query-source.d.ts +0 -33
  124. package/build/widget-sources/widget-remote-source.d.ts +0 -18
  125. package/build/widget-sources/widget-source.d.ts +0 -74
  126. package/build/widget-sources/widget-table-source.d.ts +0 -33
  127. package/build/widget-sources/widget-tileset-source.d.ts +0 -67
@@ -1,6 +1,6 @@
1
1
  import {firstBy} from 'thenby';
2
- import {SortDirection} from '../types';
3
- import {FeatureData} from '../types-internal';
2
+ import {SortDirection} from '../types.js';
3
+ import {FeatureData} from '../types-internal.js';
4
4
 
5
5
  // TODO(cleanup): Could this be simplified?
6
6
  type SortColumns = string | string[] | object[];
@@ -19,7 +19,7 @@ interface SortOptions {
19
19
  * @param [sortOptions.sortByDirection] - Direction by the columns will be sorted
20
20
  * @param [sortOptions.sortByColumnType] - Column type
21
21
  * @internal
22
- * @internalRemarks Source: @carto/react-core
22
+ * @privateRemarks Source: @carto/react-core
23
23
  */
24
24
  export function applySorting(
25
25
  features: FeatureData[],
@@ -63,7 +63,7 @@ function createSortFn({
63
63
  }) as Parameters<typeof firstBy>[];
64
64
 
65
65
  let sortFn = firstBy(...firstSortOption);
66
- for (let sortOptions of othersSortOptions) {
66
+ for (const sortOptions of othersSortOptions) {
67
67
  sortFn = sortFn.thenBy(...sortOptions);
68
68
  }
69
69
 
@@ -1,14 +1,14 @@
1
1
  import {aggregationFunctions, aggregate} from './aggregation.js';
2
- import {AggregationType} from '../types';
3
- import {FeatureData} from '../types-internal';
2
+ import {AggregationType} from '../types.js';
3
+ import {FeatureData} from '../types-internal.js';
4
4
 
5
- /** @internalRemarks Source: @carto/react-core */
5
+ /** @privateRemarks Source: @carto/react-core */
6
6
  export type GroupByFeature = {
7
7
  name: string;
8
8
  value: number;
9
9
  }[];
10
10
 
11
- /** @internalRemarks Source: @carto/react-core */
11
+ /** @privateRemarks Source: @carto/react-core */
12
12
  export function groupValuesByColumn({
13
13
  data,
14
14
  valuesColumns,
@@ -35,7 +35,7 @@ const GROUP_KEY_FN_MAPPING: Record<GroupDateType, (date: Date) => number> = {
35
35
  ),
36
36
  };
37
37
 
38
- /** @internalRemarks Source: @carto/react-core */
38
+ /** @privateRemarks Source: @carto/react-core */
39
39
  export function groupValuesByDateColumn({
40
40
  data,
41
41
  valuesColumns,
@@ -1,10 +1,10 @@
1
- import {aggregate, aggregationFunctions} from './aggregation';
2
- import {AggregationType} from '../types';
3
- import {FeatureData} from '../types-internal';
1
+ import {aggregate, aggregationFunctions} from './aggregation.js';
2
+ import {AggregationType} from '../types.js';
3
+ import {FeatureData} from '../types-internal.js';
4
4
 
5
5
  /**
6
6
  * Histogram computation.
7
- * @internalRemarks Source: @carto/react-core
7
+ * @privateRemarks Source: @carto/react-core
8
8
  */
9
9
  export function histogram({
10
10
  data,
@@ -1,12 +1,12 @@
1
- import {aggregate} from './aggregation';
2
- import {FeatureData} from '../types-internal';
3
- import {AggregationType} from '../types';
1
+ import {aggregate} from './aggregation.js';
2
+ import {FeatureData} from '../types-internal.js';
3
+ import {AggregationType} from '../types.js';
4
4
 
5
5
  export type ScatterPlotFeature = [number, number][];
6
6
 
7
7
  /**
8
8
  * Filters invalid features and formats data.
9
- * @internalRemarks Source: @carto/react-core
9
+ * @privateRemarks Source: @carto/react-core
10
10
  */
11
11
  export function scatterPlot({
12
12
  data,
@@ -2,10 +2,10 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- import {DEFAULT_API_BASE_URL} from '../constants';
6
- import {DEFAULT_MAX_LENGTH_URL} from '../constants-internal';
7
- import {buildSourceUrl} from '../api/endpoints';
8
- import {requestWithParameters} from '../api/request-with-parameters';
5
+ import {DEFAULT_API_BASE_URL} from '../constants.js';
6
+ import {DEFAULT_MAX_LENGTH_URL} from '../constants-internal.js';
7
+ import {buildSourceUrl} from '../api/endpoints.js';
8
+ import {requestWithParameters} from '../api/request-with-parameters.js';
9
9
  import type {
10
10
  GeojsonResult,
11
11
  JsonResult,
@@ -13,10 +13,10 @@ import type {
13
13
  SourceRequiredOptions,
14
14
  TilejsonMapInstantiation,
15
15
  TilejsonResult,
16
- } from './types';
17
- import {MapType} from '../types';
18
- import {APIErrorContext} from '../api';
19
- import {getClient} from '../client';
16
+ } from './types.js';
17
+ import {MapType} from '../types.js';
18
+ import {APIErrorContext} from '../api/index.js';
19
+ import {getClient} from '../client.js';
20
20
 
21
21
  export const SOURCE_DEFAULTS: SourceOptionalOptions = {
22
22
  apiBaseUrl: DEFAULT_API_BASE_URL,
@@ -3,8 +3,8 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import {QueryParameters} from '../types.js';
6
- import {baseSource} from './base-source';
7
- import type {FilterOptions, SourceOptions, TilejsonResult} from './types';
6
+ import {baseSource} from './base-source.js';
7
+ import type {FilterOptions, SourceOptions, TilejsonResult} from './types.js';
8
8
 
9
9
  export type BoundaryQuerySourceOptions = SourceOptions &
10
10
  FilterOptions & {
@@ -47,6 +47,7 @@ export const boundaryQuerySource = async function (
47
47
  if (queryParameters) {
48
48
  urlParameters.queryParameters = queryParameters;
49
49
  }
50
+
50
51
  return baseSource<UrlParameters>(
51
52
  'boundary',
52
53
  options,
@@ -2,8 +2,8 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- import {baseSource} from './base-source';
6
- import type {FilterOptions, SourceOptions, TilejsonResult} from './types';
5
+ import {baseSource} from './base-source.js';
6
+ import type {FilterOptions, SourceOptions, TilejsonResult} from './types.js';
7
7
 
8
8
  export type BoundaryTableSourceOptions = SourceOptions &
9
9
  FilterOptions & {
@@ -35,6 +35,7 @@ export const boundaryTableSource = async function (
35
35
  if (filters) {
36
36
  urlParameters.filters = filters;
37
37
  }
38
+
38
39
  return baseSource<UrlParameters>(
39
40
  'boundary',
40
41
  options,
@@ -2,10 +2,12 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- /* eslint-disable camelcase */
6
- import {DEFAULT_AGGREGATION_RES_LEVEL_H3} from '../constants-internal';
7
- import {WidgetQuerySource, WidgetQuerySourceResult} from '../widget-sources';
8
- import {baseSource} from './base-source';
5
+ import {DEFAULT_AGGREGATION_RES_LEVEL_H3} from '../constants-internal.js';
6
+ import {
7
+ WidgetQuerySource,
8
+ WidgetQuerySourceResult,
9
+ } from '../widget-sources/index.js';
10
+ import {baseSource} from './base-source.js';
9
11
  import type {
10
12
  AggregationOptions,
11
13
  FilterOptions,
@@ -13,7 +15,7 @@ import type {
13
15
  SourceOptions,
14
16
  SpatialDataType,
15
17
  TilejsonResult,
16
- } from './types';
18
+ } from './types.js';
17
19
 
18
20
  export type H3QuerySourceOptions = SourceOptions &
19
21
  QuerySourceOptions &
@@ -43,10 +45,13 @@ export const h3QuerySource = async function (
43
45
  queryParameters,
44
46
  filters,
45
47
  } = options;
48
+
49
+ const spatialDataType = 'h3';
50
+
46
51
  const urlParameters: UrlParameters = {
47
52
  aggregationExp,
48
53
  spatialDataColumn,
49
- spatialDataType: 'h3',
54
+ spatialDataType,
50
55
  q: sqlQuery,
51
56
  };
52
57
 
@@ -59,14 +64,15 @@ export const h3QuerySource = async function (
59
64
  if (filters) {
60
65
  urlParameters.filters = filters;
61
66
  }
67
+
62
68
  return baseSource<UrlParameters>('query', options, urlParameters).then(
63
69
  (result) => ({
64
70
  ...(result as TilejsonResult),
65
71
  widgetSource: new WidgetQuerySource({
66
72
  ...options,
67
- // NOTE: passing redundant spatialDataColumn here to apply the default value 'h3'
73
+ // NOTE: Parameters with default values above must be explicitly passed here.
68
74
  spatialDataColumn,
69
- spatialDataType: 'h3',
75
+ spatialDataType,
70
76
  }),
71
77
  })
72
78
  );
@@ -2,10 +2,12 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- /* eslint-disable camelcase */
6
- import {DEFAULT_AGGREGATION_RES_LEVEL_H3} from '../constants-internal';
7
- import {WidgetTableSource, WidgetTableSourceResult} from '../widget-sources';
8
- import {baseSource} from './base-source';
5
+ import {DEFAULT_AGGREGATION_RES_LEVEL_H3} from '../constants-internal.js';
6
+ import {
7
+ WidgetTableSource,
8
+ WidgetTableSourceResult,
9
+ } from '../widget-sources/index.js';
10
+ import {baseSource} from './base-source.js';
9
11
  import type {
10
12
  AggregationOptions,
11
13
  FilterOptions,
@@ -13,7 +15,7 @@ import type {
13
15
  SpatialDataType,
14
16
  TableSourceOptions,
15
17
  TilejsonResult,
16
- } from './types';
18
+ } from './types.js';
17
19
 
18
20
  export type H3TableSourceOptions = SourceOptions &
19
21
  TableSourceOptions &
@@ -41,11 +43,14 @@ export const h3TableSource = async function (
41
43
  tableName,
42
44
  filters,
43
45
  } = options;
46
+
47
+ const spatialDataType = 'h3';
48
+
44
49
  const urlParameters: UrlParameters = {
45
50
  aggregationExp,
46
51
  name: tableName,
47
52
  spatialDataColumn,
48
- spatialDataType: 'h3',
53
+ spatialDataType,
49
54
  };
50
55
 
51
56
  if (aggregationResLevel) {
@@ -54,14 +59,15 @@ export const h3TableSource = async function (
54
59
  if (filters) {
55
60
  urlParameters.filters = filters;
56
61
  }
62
+
57
63
  return baseSource<UrlParameters>('table', options, urlParameters).then(
58
64
  (result) => ({
59
65
  ...(result as TilejsonResult),
60
66
  widgetSource: new WidgetTableSource({
61
67
  ...options,
62
- // NOTE: passing redundant spatialDataColumn here to apply the default value 'h3'
68
+ // NOTE: Parameters with default values above must be explicitly passed here.
63
69
  spatialDataColumn,
64
- spatialDataType: 'h3',
70
+ spatialDataType,
65
71
  }),
66
72
  })
67
73
  );
@@ -2,17 +2,17 @@
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
+ } from '../widget-sources/index.js';
10
+ import {baseSource} from './base-source.js';
11
11
  import type {
12
12
  SourceOptions,
13
13
  TilejsonResult,
14
14
  TilesetSourceOptions,
15
- } from './types';
15
+ } from './types.js';
16
16
 
17
17
  export type H3TilesetSourceOptions = SourceOptions & TilesetSourceOptions;
18
18
  type UrlParameters = {name: string};
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- export {SOURCE_DEFAULTS} from './base-source';
5
+ export {SOURCE_DEFAULTS} from './base-source.js';
6
6
  export type {
7
7
  GeojsonResult,
8
8
  JsonResult,
@@ -13,77 +13,79 @@ export type {
13
13
  RasterMetadataBand,
14
14
  RasterMetadataBandStats,
15
15
  SourceOptions,
16
+ SpatialFilterPolyfillMode,
16
17
  TableSourceOptions,
17
18
  TilejsonResult,
19
+ TileResolution,
18
20
  TilesetSourceOptions,
19
21
  VectorLayer,
20
- } from './types';
22
+ } from './types.js';
21
23
 
22
- export {boundaryQuerySource} from './boundary-query-source';
24
+ export {boundaryQuerySource} from './boundary-query-source.js';
23
25
  export type {
24
26
  BoundaryQuerySourceOptions,
25
27
  BoundaryQuerySourceResponse,
26
- } from './boundary-query-source';
28
+ } from './boundary-query-source.js';
27
29
 
28
- export {boundaryTableSource} from './boundary-table-source';
30
+ export {boundaryTableSource} from './boundary-table-source.js';
29
31
  export type {
30
32
  BoundaryTableSourceOptions,
31
33
  BoundaryTableSourceResponse,
32
- } from './boundary-table-source';
34
+ } from './boundary-table-source.js';
33
35
 
34
- export {h3QuerySource} from './h3-query-source';
36
+ export {h3QuerySource} from './h3-query-source.js';
35
37
  export type {
36
38
  H3QuerySourceOptions,
37
39
  H3QuerySourceResponse,
38
- } from './h3-query-source';
40
+ } from './h3-query-source.js';
39
41
 
40
- export {h3TableSource} from './h3-table-source';
42
+ export {h3TableSource} from './h3-table-source.js';
41
43
  export type {
42
44
  H3TableSourceOptions,
43
45
  H3TableSourceResponse,
44
- } from './h3-table-source';
46
+ } from './h3-table-source.js';
45
47
 
46
- export {h3TilesetSource} from './h3-tileset-source';
48
+ export {h3TilesetSource} from './h3-tileset-source.js';
47
49
  export type {
48
50
  H3TilesetSourceOptions,
49
51
  H3TilesetSourceResponse,
50
- } from './h3-tileset-source';
52
+ } from './h3-tileset-source.js';
51
53
 
52
- export {rasterSource} from './raster-source';
53
- export type {RasterSourceOptions} from './raster-source';
54
+ export {rasterSource} from './raster-source.js';
55
+ export type {RasterSourceOptions} from './raster-source.js';
54
56
 
55
- export {quadbinQuerySource} from './quadbin-query-source';
57
+ export {quadbinQuerySource} from './quadbin-query-source.js';
56
58
  export type {
57
59
  QuadbinQuerySourceOptions,
58
60
  QuadbinQuerySourceResponse,
59
- } from './quadbin-query-source';
61
+ } from './quadbin-query-source.js';
60
62
 
61
- export {quadbinTableSource} from './quadbin-table-source';
63
+ export {quadbinTableSource} from './quadbin-table-source.js';
62
64
  export type {
63
65
  QuadbinTableSourceOptions,
64
66
  QuadbinTableSourceResponse,
65
- } from './quadbin-table-source';
67
+ } from './quadbin-table-source.js';
66
68
 
67
- export {quadbinTilesetSource} from './quadbin-tileset-source';
69
+ export {quadbinTilesetSource} from './quadbin-tileset-source.js';
68
70
  export type {
69
71
  QuadbinTilesetSourceOptions,
70
72
  QuadbinTilesetSourceResponse,
71
- } from './quadbin-tileset-source';
73
+ } from './quadbin-tileset-source.js';
72
74
 
73
- export {vectorQuerySource} from './vector-query-source';
75
+ export {vectorQuerySource} from './vector-query-source.js';
74
76
  export type {
75
77
  VectorQuerySourceOptions,
76
78
  VectorQuerySourceResponse,
77
- } from './vector-query-source';
79
+ } from './vector-query-source.js';
78
80
 
79
- export {vectorTableSource} from './vector-table-source';
81
+ export {vectorTableSource} from './vector-table-source.js';
80
82
  export type {
81
83
  VectorTableSourceOptions,
82
84
  VectorTableSourceResponse,
83
- } from './vector-table-source';
85
+ } from './vector-table-source.js';
84
86
 
85
- export {vectorTilesetSource} from './vector-tileset-source';
87
+ export {vectorTilesetSource} from './vector-tileset-source.js';
86
88
  export type {
87
89
  VectorTilesetSourceOptions,
88
90
  VectorTilesetSourceResponse,
89
- } from './vector-tileset-source';
91
+ } from './vector-tileset-source.js';
@@ -2,10 +2,12 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- /* eslint-disable camelcase */
6
- import {DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN} from '../constants-internal';
7
- import {WidgetQuerySource, WidgetQuerySourceResult} from '../widget-sources';
8
- import {baseSource} from './base-source';
5
+ import {DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN} from '../constants-internal.js';
6
+ import {
7
+ WidgetQuerySource,
8
+ WidgetQuerySourceResult,
9
+ } from '../widget-sources/index.js';
10
+ import {baseSource} from './base-source.js';
9
11
  import type {
10
12
  AggregationOptions,
11
13
  FilterOptions,
@@ -13,7 +15,7 @@ import type {
13
15
  SourceOptions,
14
16
  SpatialDataType,
15
17
  TilejsonResult,
16
- } from './types';
18
+ } from './types.js';
17
19
 
18
20
  export type QuadbinQuerySourceOptions = SourceOptions &
19
21
  QuerySourceOptions &
@@ -44,11 +46,14 @@ export const quadbinQuerySource = async function (
44
46
  queryParameters,
45
47
  filters,
46
48
  } = options;
49
+
50
+ const spatialDataType = 'quadbin';
51
+
47
52
  const urlParameters: UrlParameters = {
48
53
  aggregationExp,
49
54
  q: sqlQuery,
50
55
  spatialDataColumn,
51
- spatialDataType: 'quadbin',
56
+ spatialDataType,
52
57
  };
53
58
 
54
59
  if (aggregationResLevel) {
@@ -60,14 +65,15 @@ export const quadbinQuerySource = async function (
60
65
  if (filters) {
61
66
  urlParameters.filters = filters;
62
67
  }
68
+
63
69
  return baseSource<UrlParameters>('query', options, urlParameters).then(
64
70
  (result) => ({
65
71
  ...(result as TilejsonResult),
66
72
  widgetSource: new WidgetQuerySource({
67
73
  ...options,
68
- // NOTE: passing redundant spatialDataColumn here to apply the default value 'quadbin'
74
+ // NOTE: Parameters with default values above must be explicitly passed here.
69
75
  spatialDataColumn,
70
- spatialDataType: 'quadbin',
76
+ spatialDataType,
71
77
  }),
72
78
  })
73
79
  );
@@ -2,10 +2,12 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- /* eslint-disable camelcase */
6
- import {DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN} from '../constants-internal';
7
- import {WidgetTableSource, WidgetTableSourceResult} from '../widget-sources';
8
- import {baseSource} from './base-source';
5
+ import {DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN} from '../constants-internal.js';
6
+ import {
7
+ WidgetTableSource,
8
+ WidgetTableSourceResult,
9
+ } from '../widget-sources/index.js';
10
+ import {baseSource} from './base-source.js';
9
11
  import type {
10
12
  AggregationOptions,
11
13
  FilterOptions,
@@ -13,7 +15,7 @@ import type {
13
15
  SpatialDataType,
14
16
  TableSourceOptions,
15
17
  TilejsonResult,
16
- } from './types';
18
+ } from './types.js';
17
19
 
18
20
  export type QuadbinTableSourceOptions = SourceOptions &
19
21
  TableSourceOptions &
@@ -43,11 +45,13 @@ export const quadbinTableSource = async function (
43
45
  filters,
44
46
  } = options;
45
47
 
48
+ const spatialDataType = 'quadbin';
49
+
46
50
  const urlParameters: UrlParameters = {
47
51
  aggregationExp,
48
52
  name: tableName,
49
53
  spatialDataColumn,
50
- spatialDataType: 'quadbin',
54
+ spatialDataType,
51
55
  };
52
56
 
53
57
  if (aggregationResLevel) {
@@ -56,14 +60,15 @@ export const quadbinTableSource = async function (
56
60
  if (filters) {
57
61
  urlParameters.filters = filters;
58
62
  }
63
+
59
64
  return baseSource<UrlParameters>('table', options, urlParameters).then(
60
65
  (result) => ({
61
66
  ...(result as TilejsonResult),
62
67
  widgetSource: new WidgetTableSource({
63
68
  ...options,
64
- // NOTE: passing redundant spatialDataColumn here to apply the default value 'quadbin'
69
+ // NOTE: Parameters with default values above must be explicitly passed here.
65
70
  spatialDataColumn,
66
- spatialDataType: 'quadbin',
71
+ spatialDataType,
67
72
  }),
68
73
  })
69
74
  );
@@ -2,17 +2,17 @@
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
+ } from '../widget-sources/index.js';
10
+ import {baseSource} from './base-source.js';
11
11
  import type {
12
12
  SourceOptions,
13
13
  TilejsonResult,
14
14
  TilesetSourceOptions,
15
- } from './types';
15
+ } from './types.js';
16
16
 
17
17
  export type QuadbinTilesetSourceOptions = SourceOptions & TilesetSourceOptions;
18
18
  type UrlParameters = {name: string};
@@ -2,13 +2,13 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- import {baseSource} from './base-source';
5
+ import {baseSource} from './base-source.js';
6
6
  import type {
7
7
  FilterOptions,
8
8
  SourceOptions,
9
9
  TilejsonResult,
10
10
  TilesetSourceOptions,
11
- } from './types';
11
+ } from './types.js';
12
12
 
13
13
  export type RasterSourceOptions = SourceOptions &
14
14
  TilesetSourceOptions &
@@ -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
+ widgetWorker?: 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
 
@@ -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 &
@@ -53,9 +52,11 @@ export const vectorQuerySource = async function (
53
52
  aggregationExp,
54
53
  } = options;
55
54
 
55
+ const spatialDataType = 'geo';
56
+
56
57
  const urlParameters: UrlParameters = {
57
58
  spatialDataColumn,
58
- spatialDataType: 'geo',
59
+ spatialDataType,
59
60
  tileResolution: tileResolution.toString(),
60
61
  q: sqlQuery,
61
62
  };
@@ -72,13 +73,16 @@ export const vectorQuerySource = async function (
72
73
  if (aggregationExp) {
73
74
  urlParameters.aggregationExp = aggregationExp;
74
75
  }
76
+
75
77
  return baseSource<UrlParameters>('query', options, urlParameters).then(
76
78
  (result) => ({
77
79
  ...(result as TilejsonResult),
78
80
  widgetSource: new WidgetQuerySource({
79
81
  ...options,
82
+ // NOTE: Parameters with default values above must be explicitly passed here.
80
83
  spatialDataColumn,
81
- spatialDataType: 'geo',
84
+ spatialDataType,
85
+ tileResolution,
82
86
  }),
83
87
  })
84
88
  );