@carto/api-client 0.4.4 → 0.4.5-alpha.0
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.
- package/build/api-client.cjs +70 -28
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.modern.js +40 -16
- package/build/api-client.modern.js.map +1 -1
- package/package.json +30 -35
- package/src/sources/boundary-query-source.ts +1 -0
- package/src/sources/boundary-table-source.ts +1 -0
- package/src/sources/h3-query-source.ts +7 -3
- package/src/sources/h3-table-source.ts +7 -3
- package/src/sources/quadbin-query-source.ts +7 -3
- package/src/sources/quadbin-table-source.ts +6 -3
- package/src/sources/vector-query-source.ts +8 -2
- package/src/sources/vector-table-source.ts +8 -2
- package/src/utils.ts +8 -5
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.
|
|
7
|
+
"version": "0.4.5-alpha.0",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public",
|
|
@@ -57,46 +57,41 @@
|
|
|
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.
|
|
60
|
+
"@types/geojson": "^7946.0.15"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@deck.gl/aggregation-layers": "^9.0.
|
|
64
|
-
"@deck.gl/carto": "^9.0.
|
|
65
|
-
"@deck.gl/core": "^9.0.
|
|
66
|
-
"@deck.gl/extensions": "^9.0.
|
|
67
|
-
"@deck.gl/geo-layers": "^9.0.
|
|
68
|
-
"@deck.gl/layers": "^9.0.
|
|
69
|
-
"@deck.gl/mesh-layers": "^9.0.
|
|
70
|
-
"@
|
|
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.
|
|
74
|
-
"@luma.gl/core": "
|
|
75
|
-
"@luma.gl/engine": "
|
|
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.
|
|
79
|
-
"@types/react-dom": "^18.3.0",
|
|
76
|
+
"@types/react": "^18.3.18",
|
|
80
77
|
"@types/semver": "^7.5.8",
|
|
81
|
-
"@
|
|
82
|
-
"@vitest/coverage-istanbul": "^1.6.0",
|
|
78
|
+
"@vitest/coverage-istanbul": "^2.1.8",
|
|
83
79
|
"@webcomponents/webcomponentsjs": "^2.8.0",
|
|
84
|
-
"concurrently": "^
|
|
85
|
-
"echarts": "^5.
|
|
86
|
-
"lit": "^3.1
|
|
87
|
-
"lit-analyzer": "^
|
|
88
|
-
"maplibre-gl": "^
|
|
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": "^
|
|
91
|
-
"
|
|
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
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
89
|
+
"typescript": "~5.7.3",
|
|
90
|
+
"vite": "^6.0.7",
|
|
91
|
+
"vitest": "2.1.8"
|
|
92
|
+
},
|
|
93
|
+
"resolutions": {
|
|
94
|
+
"rollup": "^4.20.0"
|
|
95
|
+
},
|
|
96
|
+
"stableVersion": "0.4.4"
|
|
102
97
|
}
|
|
@@ -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
|
|
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:
|
|
71
|
+
// NOTE: Parameters with default values above must be explicitly passed here.
|
|
68
72
|
spatialDataColumn,
|
|
69
|
-
spatialDataType
|
|
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
|
|
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:
|
|
66
|
+
// NOTE: Parameters with default values above must be explicitly passed here.
|
|
63
67
|
spatialDataColumn,
|
|
64
|
-
spatialDataType
|
|
68
|
+
spatialDataType,
|
|
65
69
|
}),
|
|
66
70
|
})
|
|
67
71
|
);
|
|
@@ -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
|
|
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:
|
|
72
|
+
// NOTE: Parameters with default values above must be explicitly passed here.
|
|
69
73
|
spatialDataColumn,
|
|
70
|
-
spatialDataType
|
|
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
|
|
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:
|
|
67
|
+
// NOTE: Parameters with default values above must be explicitly passed here.
|
|
65
68
|
spatialDataColumn,
|
|
66
|
-
spatialDataType
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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(
|
|
53
|
-
acc[key
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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 */
|