@deck.gl/carto 9.0.27 → 9.0.29
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/dist/api/fetch-map.d.ts +24 -1
- package/dist/api/fetch-map.d.ts.map +1 -1
- package/dist/api/fetch-map.js +4 -4
- package/dist/cartoRasterTile-worker.js +1 -1
- package/dist/cartoSpatialTile-worker.js +1 -1
- package/dist/cartoVectorTile-worker.js +1 -1
- package/dist/dist.dev.js +4 -0
- package/dist/index.cjs +7 -4
- package/dist/index.cjs.map +2 -2
- package/dist/layers/heatmap.d.ts.map +1 -1
- package/dist/layers/heatmap.js +1 -0
- package/dist/layers/schema/carto-raster-tile-loader.js +1 -1
- package/dist/layers/schema/carto-spatial-tile-loader.js +1 -1
- package/dist/layers/schema/carto-vector-tile-loader.js +1 -1
- package/dist.min.js +6 -6
- package/package.json +4 -4
- package/src/api/fetch-map.ts +33 -3
- package/src/layers/heatmap.ts +1 -0
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "CARTO official integration with Deck.gl. Build geospatial applications using CARTO and Deck.gl.",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "9.0.
|
|
6
|
+
"version": "9.0.29",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"@loaders.gl/mvt": "^4.2.0",
|
|
48
48
|
"@loaders.gl/schema": "^4.2.0",
|
|
49
49
|
"@loaders.gl/tiles": "^4.2.0",
|
|
50
|
-
"@luma.gl/core": "
|
|
51
|
-
"@luma.gl/shadertools": "
|
|
50
|
+
"@luma.gl/core": "~9.0.27",
|
|
51
|
+
"@luma.gl/shadertools": "~9.0.27",
|
|
52
52
|
"@math.gl/web-mercator": "^4.0.0",
|
|
53
53
|
"@types/d3-array": "^3.0.2",
|
|
54
54
|
"@types/d3-color": "^1.4.2",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"@deck.gl/layers": "^9.0.0",
|
|
73
73
|
"@loaders.gl/core": "^4.2.0"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "eb43281ae27f0a2859d0f76d3f1b68b261ebbe38"
|
|
76
76
|
}
|
package/src/api/fetch-map.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
/* eslint-disable camelcase */
|
|
2
|
-
/**
|
|
3
|
-
* Maps API Client for Carto 3
|
|
4
|
-
*/
|
|
5
2
|
import {CartoAPIError} from './carto-api-error';
|
|
6
3
|
import {DEFAULT_API_BASE_URL, DEFAULT_CLIENT} from './common';
|
|
7
4
|
import {buildPublicMapUrl, buildStatsUrl} from './endpoints';
|
|
@@ -206,11 +203,39 @@ async function fillInTileStats(
|
|
|
206
203
|
}
|
|
207
204
|
|
|
208
205
|
export type FetchMapOptions = {
|
|
206
|
+
/**
|
|
207
|
+
* CARTO platform access token. Only required for private maps.
|
|
208
|
+
*/
|
|
209
|
+
accessToken?: string;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Base URL of the CARTO Maps API.
|
|
213
|
+
*
|
|
214
|
+
* Example for account located in EU-west region: `https://gcp-eu-west1.api.carto.com`
|
|
215
|
+
*
|
|
216
|
+
* @default https://gcp-us-east1.api.carto.com
|
|
217
|
+
*/
|
|
209
218
|
apiBaseUrl?: string;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Identifier of map created in CARTO Builder.
|
|
222
|
+
*/
|
|
210
223
|
cartoMapId: string;
|
|
211
224
|
clientId?: string;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Custom HTTP headers added to map instantiation and data requests.
|
|
228
|
+
*/
|
|
212
229
|
headers?: Record<string, string>;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Interval in seconds at which to autoRefresh the data. If provided, `onNewData` must also be provided.
|
|
233
|
+
*/
|
|
213
234
|
autoRefresh?: number;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Callback function that will be invoked whenever data in layers is changed. If provided, `autoRefresh` must also be provided.
|
|
238
|
+
*/
|
|
214
239
|
onNewData?: (map: any) => void;
|
|
215
240
|
};
|
|
216
241
|
|
|
@@ -224,6 +249,7 @@ export type FetchMapResult = ParseMapResult & {
|
|
|
224
249
|
|
|
225
250
|
/* eslint-disable max-statements */
|
|
226
251
|
export async function fetchMap({
|
|
252
|
+
accessToken,
|
|
227
253
|
apiBaseUrl = DEFAULT_API_BASE_URL,
|
|
228
254
|
cartoMapId,
|
|
229
255
|
clientId = DEFAULT_CLIENT,
|
|
@@ -234,6 +260,10 @@ export async function fetchMap({
|
|
|
234
260
|
assert(cartoMapId, 'Must define CARTO map id: fetchMap({cartoMapId: "XXXX-XXXX-XXXX"})');
|
|
235
261
|
assert(apiBaseUrl, 'Must define apiBaseUrl');
|
|
236
262
|
|
|
263
|
+
if (accessToken) {
|
|
264
|
+
headers = {Authorization: `Bearer ${accessToken}`, ...headers};
|
|
265
|
+
}
|
|
266
|
+
|
|
237
267
|
if (autoRefresh || onNewData) {
|
|
238
268
|
assert(onNewData, 'Must define `onNewData` when using autoRefresh');
|
|
239
269
|
assert(typeof onNewData === 'function', '`onNewData` must be a function');
|
package/src/layers/heatmap.ts
CHANGED