@carto/api-client 0.4.4 → 0.4.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.
@@ -1,5 +1,5 @@
1
1
  export { SOURCE_DEFAULTS } from './base-source';
2
- export type { GeojsonResult, JsonResult, QueryResult, QuerySourceOptions, RasterBandColorinterp, RasterMetadata, RasterMetadataBand, RasterMetadataBandStats, SourceOptions, TableSourceOptions, TilejsonResult, TilesetSourceOptions, VectorLayer, } from './types';
2
+ export type { GeojsonResult, JsonResult, QueryResult, QuerySourceOptions, RasterBandColorinterp, RasterMetadata, RasterMetadataBand, RasterMetadataBandStats, SourceOptions, SpatialFilterPolyfillMode, TableSourceOptions, TilejsonResult, TileResolution, TilesetSourceOptions, VectorLayer, } from './types';
3
3
  export { boundaryQuerySource } from './boundary-query-source';
4
4
  export type { BoundaryQuerySourceOptions, BoundaryQuerySourceResponse, } from './boundary-query-source';
5
5
  export { boundaryTableSource } from './boundary-table-source';
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "repository": "github:CartoDB/carto-api-client",
5
5
  "author": "Don McCurdy <donmccurdy@carto.com>",
6
6
  "packageManager": "yarn@4.3.1",
7
- "version": "0.4.4",
7
+ "version": "0.4.5",
8
8
  "license": "MIT",
9
9
  "publishConfig": {
10
10
  "access": "public",
@@ -57,46 +57,40 @@
57
57
  "@turf/helpers": "^7.1.0",
58
58
  "@turf/invariant": "^7.1.0",
59
59
  "@turf/union": "^7.1.0",
60
- "@types/geojson": "^7946.0.14"
60
+ "@types/geojson": "^7946.0.15"
61
61
  },
62
62
  "devDependencies": {
63
- "@deck.gl/aggregation-layers": "^9.0.30",
64
- "@deck.gl/carto": "^9.0.30",
65
- "@deck.gl/core": "^9.0.30",
66
- "@deck.gl/extensions": "^9.0.30",
67
- "@deck.gl/geo-layers": "^9.0.30",
68
- "@deck.gl/layers": "^9.0.30",
69
- "@deck.gl/mesh-layers": "^9.0.30",
70
- "@deck.gl/react": "^9.0.30",
71
- "@lit/react": "^1.0.5",
63
+ "@deck.gl/aggregation-layers": "^9.0.38",
64
+ "@deck.gl/carto": "^9.0.38",
65
+ "@deck.gl/core": "^9.0.38",
66
+ "@deck.gl/extensions": "^9.0.38",
67
+ "@deck.gl/geo-layers": "^9.0.38",
68
+ "@deck.gl/layers": "^9.0.38",
69
+ "@deck.gl/mesh-layers": "^9.0.38",
70
+ "@lit/react": "^1.0.6",
72
71
  "@lit/task": "^1.0.1",
73
- "@loaders.gl/core": "^4.2.3",
74
- "@luma.gl/core": "^9.0.27",
75
- "@luma.gl/engine": "^9.0.27",
76
- "@sveltejs/vite-plugin-svelte": "^3.1.2",
72
+ "@loaders.gl/core": "^4.3.3",
73
+ "@luma.gl/core": "9.0.27",
74
+ "@luma.gl/engine": "9.0.27",
77
75
  "@types/json-schema": "^7.0.15",
78
- "@types/react": "^18.3.3",
79
- "@types/react-dom": "^18.3.0",
76
+ "@types/react": "^18.3.18",
80
77
  "@types/semver": "^7.5.8",
81
- "@vitejs/plugin-vue": "^5.0.5",
82
- "@vitest/coverage-istanbul": "^1.6.0",
78
+ "@vitest/coverage-istanbul": "^2.1.8",
83
79
  "@webcomponents/webcomponentsjs": "^2.8.0",
84
- "concurrently": "^8.2.2",
85
- "echarts": "^5.5.0",
86
- "lit": "^3.1.4",
87
- "lit-analyzer": "^1.2.1",
88
- "maplibre-gl": "^4.6.0",
80
+ "concurrently": "^9.1.2",
81
+ "echarts": "^5.6.0",
82
+ "lit": "^3.2.1",
83
+ "lit-analyzer": "^2.0.3",
84
+ "maplibre-gl": "^5.0.0",
89
85
  "microbundle": "^0.15.1",
90
- "prettier": "^2.6.2",
91
- "react": "^18.3.1",
92
- "react-dom": "^18.3.1",
93
- "react-map-gl": "^7.1.7",
94
- "rimraf": "^3.0.2",
86
+ "prettier": "^3.4.2",
87
+ "rimraf": "^6.0.1",
95
88
  "semver": "^7.6.3",
96
- "svelte": "^4.2.17",
97
- "typescript": "~5.3.3",
98
- "vite": "^5.2.10",
99
- "vitest": "1.6.0",
100
- "vue": "^3.4.27"
89
+ "typescript": "~5.7.3",
90
+ "vite": "^6.0.7",
91
+ "vitest": "2.1.8"
92
+ },
93
+ "resolutions": {
94
+ "rollup": "^4.20.0"
101
95
  }
102
96
  }
@@ -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,
@@ -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,
@@ -43,10 +43,13 @@ export const h3QuerySource = async function (
43
43
  queryParameters,
44
44
  filters,
45
45
  } = options;
46
+
47
+ const spatialDataType = 'h3';
48
+
46
49
  const urlParameters: UrlParameters = {
47
50
  aggregationExp,
48
51
  spatialDataColumn,
49
- spatialDataType: 'h3',
52
+ spatialDataType,
50
53
  q: sqlQuery,
51
54
  };
52
55
 
@@ -59,14 +62,15 @@ export const h3QuerySource = async function (
59
62
  if (filters) {
60
63
  urlParameters.filters = filters;
61
64
  }
65
+
62
66
  return baseSource<UrlParameters>('query', options, urlParameters).then(
63
67
  (result) => ({
64
68
  ...(result as TilejsonResult),
65
69
  widgetSource: new WidgetQuerySource({
66
70
  ...options,
67
- // NOTE: passing redundant spatialDataColumn here to apply the default value 'h3'
71
+ // NOTE: Parameters with default values above must be explicitly passed here.
68
72
  spatialDataColumn,
69
- spatialDataType: 'h3',
73
+ spatialDataType,
70
74
  }),
71
75
  })
72
76
  );
@@ -41,11 +41,14 @@ export const h3TableSource = async function (
41
41
  tableName,
42
42
  filters,
43
43
  } = options;
44
+
45
+ const spatialDataType = 'h3';
46
+
44
47
  const urlParameters: UrlParameters = {
45
48
  aggregationExp,
46
49
  name: tableName,
47
50
  spatialDataColumn,
48
- spatialDataType: 'h3',
51
+ spatialDataType,
49
52
  };
50
53
 
51
54
  if (aggregationResLevel) {
@@ -54,14 +57,15 @@ export const h3TableSource = async function (
54
57
  if (filters) {
55
58
  urlParameters.filters = filters;
56
59
  }
60
+
57
61
  return baseSource<UrlParameters>('table', options, urlParameters).then(
58
62
  (result) => ({
59
63
  ...(result as TilejsonResult),
60
64
  widgetSource: new WidgetTableSource({
61
65
  ...options,
62
- // NOTE: passing redundant spatialDataColumn here to apply the default value 'h3'
66
+ // NOTE: Parameters with default values above must be explicitly passed here.
63
67
  spatialDataColumn,
64
- spatialDataType: 'h3',
68
+ spatialDataType,
65
69
  }),
66
70
  })
67
71
  );
@@ -13,8 +13,10 @@ 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
22
  } from './types';
@@ -44,11 +44,14 @@ export const quadbinQuerySource = async function (
44
44
  queryParameters,
45
45
  filters,
46
46
  } = options;
47
+
48
+ const spatialDataType = 'quadbin';
49
+
47
50
  const urlParameters: UrlParameters = {
48
51
  aggregationExp,
49
52
  q: sqlQuery,
50
53
  spatialDataColumn,
51
- spatialDataType: 'quadbin',
54
+ spatialDataType,
52
55
  };
53
56
 
54
57
  if (aggregationResLevel) {
@@ -60,14 +63,15 @@ export const quadbinQuerySource = async function (
60
63
  if (filters) {
61
64
  urlParameters.filters = filters;
62
65
  }
66
+
63
67
  return baseSource<UrlParameters>('query', options, urlParameters).then(
64
68
  (result) => ({
65
69
  ...(result as TilejsonResult),
66
70
  widgetSource: new WidgetQuerySource({
67
71
  ...options,
68
- // NOTE: passing redundant spatialDataColumn here to apply the default value 'quadbin'
72
+ // NOTE: Parameters with default values above must be explicitly passed here.
69
73
  spatialDataColumn,
70
- spatialDataType: 'quadbin',
74
+ spatialDataType,
71
75
  }),
72
76
  })
73
77
  );
@@ -43,11 +43,13 @@ export const quadbinTableSource = async function (
43
43
  filters,
44
44
  } = options;
45
45
 
46
+ const spatialDataType = 'quadbin';
47
+
46
48
  const urlParameters: UrlParameters = {
47
49
  aggregationExp,
48
50
  name: tableName,
49
51
  spatialDataColumn,
50
- spatialDataType: 'quadbin',
52
+ spatialDataType,
51
53
  };
52
54
 
53
55
  if (aggregationResLevel) {
@@ -56,14 +58,15 @@ export const quadbinTableSource = async function (
56
58
  if (filters) {
57
59
  urlParameters.filters = filters;
58
60
  }
61
+
59
62
  return baseSource<UrlParameters>('table', options, urlParameters).then(
60
63
  (result) => ({
61
64
  ...(result as TilejsonResult),
62
65
  widgetSource: new WidgetTableSource({
63
66
  ...options,
64
- // NOTE: passing redundant spatialDataColumn here to apply the default value 'quadbin'
67
+ // NOTE: Parameters with default values above must be explicitly passed here.
65
68
  spatialDataColumn,
66
- spatialDataType: 'quadbin',
69
+ spatialDataType,
67
70
  }),
68
71
  })
69
72
  );
@@ -50,9 +50,11 @@ export const vectorQuerySource = async function (
50
50
  aggregationExp,
51
51
  } = options;
52
52
 
53
+ const spatialDataType = 'geo';
54
+
53
55
  const urlParameters: UrlParameters = {
54
56
  spatialDataColumn,
55
- spatialDataType: 'geo',
57
+ spatialDataType,
56
58
  tileResolution: tileResolution.toString(),
57
59
  q: sqlQuery,
58
60
  };
@@ -69,12 +71,16 @@ export const vectorQuerySource = async function (
69
71
  if (aggregationExp) {
70
72
  urlParameters.aggregationExp = aggregationExp;
71
73
  }
74
+
72
75
  return baseSource<UrlParameters>('query', options, urlParameters).then(
73
76
  (result) => ({
74
77
  ...(result as TilejsonResult),
75
78
  widgetSource: new WidgetQuerySource({
76
79
  ...options,
77
- spatialDataType: 'geo',
80
+ // NOTE: Parameters with default values above must be explicitly passed here.
81
+ spatialDataColumn,
82
+ spatialDataType,
83
+ tileResolution,
78
84
  }),
79
85
  })
80
86
  );
@@ -48,10 +48,12 @@ export const vectorTableSource = async function (
48
48
  aggregationExp,
49
49
  } = options;
50
50
 
51
+ const spatialDataType = 'geo';
52
+
51
53
  const urlParameters: UrlParameters = {
52
54
  name: tableName,
53
55
  spatialDataColumn,
54
- spatialDataType: 'geo',
56
+ spatialDataType,
55
57
  tileResolution: tileResolution.toString(),
56
58
  };
57
59
 
@@ -64,12 +66,16 @@ export const vectorTableSource = async function (
64
66
  if (aggregationExp) {
65
67
  urlParameters.aggregationExp = aggregationExp;
66
68
  }
69
+
67
70
  return baseSource<UrlParameters>('table', options, urlParameters).then(
68
71
  (result) => ({
69
72
  ...(result as TilejsonResult),
70
73
  widgetSource: new WidgetTableSource({
71
74
  ...options,
72
- spatialDataType: 'geo',
75
+ // NOTE: Parameters with default values above must be explicitly passed here.
76
+ spatialDataColumn,
77
+ spatialDataType,
78
+ tileResolution,
73
79
  }),
74
80
  })
75
81
  );
package/src/utils.ts CHANGED
@@ -49,11 +49,14 @@ export function normalizeObjectKeys<T, R extends Row<T>>(el: R): R {
49
49
  return el;
50
50
  }
51
51
 
52
- return Object.entries(el as Record<string, T>).reduce((acc, [key, value]) => {
53
- acc[key.toLowerCase()] =
54
- typeof value === 'object' && value ? normalizeObjectKeys(value) : value;
55
- return acc;
56
- }, {} as Record<string, T>) as R;
52
+ return Object.entries(el as Record<string, T>).reduce(
53
+ (acc, [key, value]) => {
54
+ acc[key.toLowerCase()] =
55
+ typeof value === 'object' && value ? normalizeObjectKeys(value) : value;
56
+ return acc;
57
+ },
58
+ {} as Record<string, T>
59
+ ) as R;
57
60
  }
58
61
 
59
62
  /** @internalRemarks Source: @carto/react-core */