@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
package/src/filters.ts CHANGED
@@ -1,6 +1,6 @@
1
- import {FilterType} from './constants';
2
- import {Filter} from './types';
3
- import {isEmptyObject} from './utils';
1
+ import {FilterType} from './constants.js';
2
+ import {Filter} from './types.js';
3
+ import {isEmptyObject} from './utils.js';
4
4
 
5
5
  type FilterTypeOptions<T extends FilterType> = {
6
6
  type: T;
@@ -121,7 +121,7 @@ export function getFilter<T extends FilterType>(
121
121
  return null;
122
122
  }
123
123
 
124
- if (!owner || owner === filter[type as FilterType]?.owner) {
124
+ if (!owner || owner === filter[type]?.owner) {
125
125
  return filter[type] || null;
126
126
  }
127
127
 
package/src/geo.ts CHANGED
@@ -4,7 +4,7 @@ import union from '@turf/union';
4
4
  import {getType} from '@turf/invariant';
5
5
  import {polygon, multiPolygon, feature, featureCollection} from '@turf/helpers';
6
6
  import type {BBox, Geometry, MultiPolygon, Polygon, Position} from 'geojson';
7
- import {SpatialFilter} from './types';
7
+ import {SpatialFilter} from './types.js';
8
8
 
9
9
  /**
10
10
  * Returns a {@link SpatialFilter} for a given viewport, typically obtained
@@ -40,7 +40,7 @@ export function createPolygonSpatialFilter(
40
40
  * Check if a viewport is large enough to represent a global coverage.
41
41
  * In this case the spatial filter parameter for widget calculation is removed.
42
42
  *
43
- * @internalRemarks Source: @carto/react-core
43
+ * @privateRemarks Source: @carto/react-core
44
44
  */
45
45
  function _isGlobalViewport(viewport: BBox) {
46
46
  const [minx, miny, maxx, maxy] = viewport;
@@ -54,7 +54,7 @@ function _isGlobalViewport(viewport: BBox) {
54
54
  *
55
55
  * It results in a Polygon or MultiPolygon strictly inside the validity range.
56
56
  *
57
- * @internalRemarks Source: @carto/react-core
57
+ * @privateRemarks Source: @carto/react-core
58
58
  */
59
59
  function _normalizeGeometry(
60
60
  geometry: Polygon | MultiPolygon
@@ -100,19 +100,19 @@ function _normalizeGeometry(
100
100
  return result;
101
101
  }
102
102
 
103
- /** @internalRemarks Source: @carto/react-core */
103
+ /** @privateRemarks Source: @carto/react-core */
104
104
  function _cleanPolygonCoords(cc: Position[][]) {
105
105
  const coords = cc.filter((c) => c.length > 0);
106
106
  return coords.length > 0 ? coords : null;
107
107
  }
108
108
 
109
- /** @internalRemarks Source: @carto/react-core */
109
+ /** @privateRemarks Source: @carto/react-core */
110
110
  function _cleanMultiPolygonCoords(ccc: Position[][][]) {
111
111
  const coords = ccc.map(_cleanPolygonCoords).filter((cc) => cc);
112
112
  return coords.length > 0 ? coords : null;
113
113
  }
114
114
 
115
- /** @internalRemarks Source: @carto/react-core */
115
+ /** @privateRemarks Source: @carto/react-core */
116
116
  function _clean(
117
117
  geometry: Polygon | MultiPolygon | null
118
118
  ): Polygon | MultiPolygon | null {
@@ -121,36 +121,34 @@ function _clean(
121
121
  }
122
122
 
123
123
  if (_isPolygon(geometry)) {
124
- const coords = _cleanPolygonCoords((geometry as Polygon).coordinates);
124
+ const coords = _cleanPolygonCoords(geometry.coordinates);
125
125
  return coords ? polygon(coords).geometry : null;
126
126
  }
127
127
 
128
128
  if (_isMultiPolygon(geometry)) {
129
- const coords = _cleanMultiPolygonCoords(
130
- (geometry as MultiPolygon).coordinates
131
- );
129
+ const coords = _cleanMultiPolygonCoords(geometry.coordinates);
132
130
  return coords ? multiPolygon(coords as Position[][][]).geometry : null;
133
131
  }
134
132
 
135
133
  return null;
136
134
  }
137
135
 
138
- /** @internalRemarks Source: @carto/react-core */
136
+ /** @privateRemarks Source: @carto/react-core */
139
137
  function _txContourCoords(cc: Position[], distance: number) {
140
138
  return cc.map((c) => [c[0] + distance, c[1]]);
141
139
  }
142
140
 
143
- /** @internalRemarks Source: @carto/react-core */
141
+ /** @privateRemarks Source: @carto/react-core */
144
142
  function _txPolygonCoords(ccc: Position[][], distance: number) {
145
143
  return ccc.map((cc) => _txContourCoords(cc, distance));
146
144
  }
147
145
 
148
- /** @internalRemarks Source: @carto/react-core */
146
+ /** @privateRemarks Source: @carto/react-core */
149
147
  function _txMultiPolygonCoords(cccc: Position[][][], distance: number) {
150
148
  return cccc.map((ccc) => _txPolygonCoords(ccc, distance));
151
149
  }
152
150
 
153
- /** @internalRemarks Source: @carto/react-core */
151
+ /** @privateRemarks Source: @carto/react-core */
154
152
  function _tx(geometry: Polygon | MultiPolygon, distance: number) {
155
153
  if (geometry && getType(geometry) === 'Polygon') {
156
154
  const coords = _txPolygonCoords(
package/src/global.d.ts CHANGED
@@ -1,10 +1,5 @@
1
- /**
2
- * Injected by microbundle, with:
3
- * ```
4
- * --define __CARTO_API_CLIENT_VERSION=$npm_package_version
5
- * ```
6
- */
7
- declare const __CARTO_API_CLIENT_VERSION: string;
8
-
9
1
  /** Defined by @deck.gl/core. */
10
2
  declare const deck: {VERSION: string | undefined} | undefined;
3
+
4
+ /** Defined by tsup. */
5
+ declare const TSUP_FORMAT: 'esm' | 'cjs';
package/src/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './client.js';
2
2
  export * from './constants.js';
3
+ export * from './deck/index.js';
3
4
  export * from './filters.js';
4
5
  export * from './geo.js';
5
6
  export * from './sources/index.js';
@@ -1,8 +1,9 @@
1
1
  import {InvalidColumnError} from '../utils.js';
2
2
 
3
- /** @internalRemarks Source: @carto/react-api */
3
+ /** @privateRemarks Source: @carto/react-api */
4
4
  export interface ModelRequestOptions {
5
5
  method: 'GET' | 'POST';
6
+ headers?: Record<string, string>;
6
7
  abortController?: AbortController;
7
8
  otherOptions?: Record<string, unknown>;
8
9
  body?: string;
@@ -16,7 +17,7 @@ interface ModelErrorResponse {
16
17
 
17
18
  /**
18
19
  * Return more descriptive error from API
19
- * @internalRemarks Source: @carto/react-api
20
+ * @privateRemarks Source: @carto/react-api
20
21
  */
21
22
  export function dealWithApiError({
22
23
  response,
@@ -42,15 +43,15 @@ export function dealWithApiError({
42
43
  case 403:
43
44
  throw new Error('Forbidden access to the requested data');
44
45
  default:
45
- const msg =
46
+ throw new Error(
46
47
  data && data.error && typeof data.error === 'string'
47
48
  ? data.error
48
- : JSON.stringify(data?.hint || data.error?.[0]);
49
- throw new Error(msg);
49
+ : JSON.stringify(data?.hint || data.error?.[0])
50
+ );
50
51
  }
51
52
  }
52
53
 
53
- /** @internalRemarks Source: @carto/react-api */
54
+ /** @privateRemarks Source: @carto/react-api */
54
55
  export async function makeCall({
55
56
  url,
56
57
  accessToken,
@@ -68,6 +69,7 @@ export async function makeCall({
68
69
  headers: {
69
70
  Authorization: `Bearer ${accessToken}`,
70
71
  ...(isPost && {'Content-Type': 'application/json'}),
72
+ ...opts.headers,
71
73
  },
72
74
  ...(isPost && {
73
75
  method: opts?.method,
@@ -80,7 +82,7 @@ export async function makeCall({
80
82
  } catch (error) {
81
83
  if ((error as Error).name === 'AbortError') throw error;
82
84
 
83
- throw new Error(`Failed request: ${error}`);
85
+ throw new Error(`Failed request: ${error as Error}`);
84
86
  }
85
87
 
86
88
  if (!response.ok) {
@@ -6,13 +6,12 @@ import {
6
6
  QueryParameters,
7
7
  SpatialFilter,
8
8
  } from '../types.js';
9
- import {$TODO} from '../types-internal.js';
10
9
  import {assert, isPureObject} from '../utils.js';
11
10
  import {ModelRequestOptions, makeCall} from './common.js';
12
11
  import {ApiVersion} from '../constants.js';
13
12
  import {SpatialDataType, SpatialFilterPolyfillMode} from '../sources/types.js';
14
13
 
15
- /** @internalRemarks Source: @carto/react-api */
14
+ /** @privateRemarks Source: @carto/react-api */
16
15
  const AVAILABLE_MODELS = [
17
16
  'category',
18
17
  'histogram',
@@ -51,7 +50,7 @@ const REQUEST_GET_MAX_URL_LENGTH = 2048;
51
50
 
52
51
  /**
53
52
  * Execute a SQL model request.
54
- * @internalRemarks Source: @carto/react-api
53
+ * @privateRemarks Source: @carto/react-api
55
54
  */
56
55
  export function executeModel(props: {
57
56
  model: Model;
@@ -152,7 +151,7 @@ function objectToURLSearchParams(object: Record<string, unknown>) {
152
151
  } else if (object[key] === null) {
153
152
  params.append(key, 'null');
154
153
  } else if (object[key] !== undefined) {
155
- params.append(key, String(object[key]));
154
+ params.append(key, String(object[key] as unknown));
156
155
  }
157
156
  }
158
157
  return params;
@@ -1,14 +1,14 @@
1
- import {AggregationType} from '../types';
2
- import {FeatureData} from '../types-internal';
1
+ import {AggregationType} from '../types.js';
2
+ import {FeatureData} from '../types-internal.js';
3
3
 
4
- /** @internalRemarks Source: @carto/react-core */
4
+ /** @privateRemarks Source: @carto/react-core */
5
5
  export type AggregationFunction = (
6
6
  values: unknown[] | FeatureData[],
7
7
  keys?: string[] | string,
8
8
  joinOperation?: AggregationType
9
9
  ) => number;
10
10
 
11
- /** @internalRemarks Source: @carto/react-core */
11
+ /** @privateRemarks Source: @carto/react-core */
12
12
  export const aggregationFunctions: Record<
13
13
  Exclude<AggregationType, 'custom'>,
14
14
  AggregationFunction
@@ -20,7 +20,7 @@ export const aggregationFunctions: Record<
20
20
  avg: (...args) => applyAggregationFunction(avg, ...args),
21
21
  };
22
22
 
23
- /** @internalRemarks Source: @carto/react-core */
23
+ /** @privateRemarks Source: @carto/react-core */
24
24
  export function aggregate(
25
25
  feature: FeatureData,
26
26
  keys?: string[],
@@ -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 & {
@@ -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 & {
@@ -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 &
@@ -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 &
@@ -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 H3TilesetSourceOptions = SourceOptions & TilesetSourceOptions;
18
20
  type UrlParameters = {name: string};
@@ -26,10 +28,15 @@ export const h3TilesetSource = async function (
26
28
  const {tableName, spatialDataColumn = 'h3'} = 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,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,
@@ -19,73 +19,73 @@ export type {
19
19
  TileResolution,
20
20
  TilesetSourceOptions,
21
21
  VectorLayer,
22
- } from './types';
22
+ } from './types.js';
23
23
 
24
- export {boundaryQuerySource} from './boundary-query-source';
24
+ export {boundaryQuerySource} from './boundary-query-source.js';
25
25
  export type {
26
26
  BoundaryQuerySourceOptions,
27
27
  BoundaryQuerySourceResponse,
28
- } from './boundary-query-source';
28
+ } from './boundary-query-source.js';
29
29
 
30
- export {boundaryTableSource} from './boundary-table-source';
30
+ export {boundaryTableSource} from './boundary-table-source.js';
31
31
  export type {
32
32
  BoundaryTableSourceOptions,
33
33
  BoundaryTableSourceResponse,
34
- } from './boundary-table-source';
34
+ } from './boundary-table-source.js';
35
35
 
36
- export {h3QuerySource} from './h3-query-source';
36
+ export {h3QuerySource} from './h3-query-source.js';
37
37
  export type {
38
38
  H3QuerySourceOptions,
39
39
  H3QuerySourceResponse,
40
- } from './h3-query-source';
40
+ } from './h3-query-source.js';
41
41
 
42
- export {h3TableSource} from './h3-table-source';
42
+ export {h3TableSource} from './h3-table-source.js';
43
43
  export type {
44
44
  H3TableSourceOptions,
45
45
  H3TableSourceResponse,
46
- } from './h3-table-source';
46
+ } from './h3-table-source.js';
47
47
 
48
- export {h3TilesetSource} from './h3-tileset-source';
48
+ export {h3TilesetSource} from './h3-tileset-source.js';
49
49
  export type {
50
50
  H3TilesetSourceOptions,
51
51
  H3TilesetSourceResponse,
52
- } from './h3-tileset-source';
52
+ } from './h3-tileset-source.js';
53
53
 
54
- export {rasterSource} from './raster-source';
55
- export type {RasterSourceOptions} from './raster-source';
54
+ export {rasterSource} from './raster-source.js';
55
+ export type {RasterSourceOptions} from './raster-source.js';
56
56
 
57
- export {quadbinQuerySource} from './quadbin-query-source';
57
+ export {quadbinQuerySource} from './quadbin-query-source.js';
58
58
  export type {
59
59
  QuadbinQuerySourceOptions,
60
60
  QuadbinQuerySourceResponse,
61
- } from './quadbin-query-source';
61
+ } from './quadbin-query-source.js';
62
62
 
63
- export {quadbinTableSource} from './quadbin-table-source';
63
+ export {quadbinTableSource} from './quadbin-table-source.js';
64
64
  export type {
65
65
  QuadbinTableSourceOptions,
66
66
  QuadbinTableSourceResponse,
67
- } from './quadbin-table-source';
67
+ } from './quadbin-table-source.js';
68
68
 
69
- export {quadbinTilesetSource} from './quadbin-tileset-source';
69
+ export {quadbinTilesetSource} from './quadbin-tileset-source.js';
70
70
  export type {
71
71
  QuadbinTilesetSourceOptions,
72
72
  QuadbinTilesetSourceResponse,
73
- } from './quadbin-tileset-source';
73
+ } from './quadbin-tileset-source.js';
74
74
 
75
- export {vectorQuerySource} from './vector-query-source';
75
+ export {vectorQuerySource} from './vector-query-source.js';
76
76
  export type {
77
77
  VectorQuerySourceOptions,
78
78
  VectorQuerySourceResponse,
79
- } from './vector-query-source';
79
+ } from './vector-query-source.js';
80
80
 
81
- export {vectorTableSource} from './vector-table-source';
81
+ export {vectorTableSource} from './vector-table-source.js';
82
82
  export type {
83
83
  VectorTableSourceOptions,
84
84
  VectorTableSourceResponse,
85
- } from './vector-table-source';
85
+ } from './vector-table-source.js';
86
86
 
87
- export {vectorTilesetSource} from './vector-tileset-source';
87
+ export {vectorTilesetSource} from './vector-tileset-source.js';
88
88
  export type {
89
89
  VectorTilesetSourceOptions,
90
90
  VectorTilesetSourceResponse,
91
- } 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 &
@@ -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 &