@deck.gl/carto
Advanced tools
Comparing version 8.8.6 to 8.8.7
@@ -47,3 +47,3 @@ "use strict"; | ||
_request = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(_ref) { | ||
var method, url, accessToken, body, headers; | ||
var method, url, customHeaders, accessToken, body, headers; | ||
return _regenerator.default.wrap(function _callee$(_context) { | ||
@@ -53,6 +53,6 @@ while (1) { | ||
case 0: | ||
method = _ref.method, url = _ref.url, accessToken = _ref.accessToken, body = _ref.body; | ||
headers = { | ||
method = _ref.method, url = _ref.url, customHeaders = _ref.headers, accessToken = _ref.accessToken, body = _ref.body; | ||
headers = _objectSpread(_objectSpread({}, customHeaders), {}, { | ||
Accept: 'application/json' | ||
}; | ||
}); | ||
@@ -99,3 +99,3 @@ if (accessToken) { | ||
_requestJson = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(_ref2) { | ||
var method, url, accessToken, body, response, json; | ||
var method, url, headers, accessToken, body, response, json; | ||
return _regenerator.default.wrap(function _callee2$(_context2) { | ||
@@ -105,3 +105,3 @@ while (1) { | ||
case 0: | ||
method = _ref2.method, url = _ref2.url, accessToken = _ref2.accessToken, body = _ref2.body; | ||
method = _ref2.method, url = _ref2.url, headers = _ref2.headers, accessToken = _ref2.accessToken, body = _ref2.body; | ||
_context2.next = 3; | ||
@@ -111,2 +111,3 @@ return request({ | ||
url: url, | ||
headers: headers, | ||
accessToken: accessToken, | ||
@@ -257,3 +258,3 @@ body: body | ||
_mapInstantiation = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee4(_ref6) { | ||
var type, source, connection, credentials, geoColumn, columns, clientId, aggregationExp, aggregationResLevel, queryParameters, baseUrl, url, accessToken, body; | ||
var type, source, connection, credentials, geoColumn, columns, clientId, headers, aggregationExp, aggregationResLevel, queryParameters, baseUrl, url, accessToken, body; | ||
return _regenerator.default.wrap(function _callee4$(_context4) { | ||
@@ -263,3 +264,3 @@ while (1) { | ||
case 0: | ||
type = _ref6.type, source = _ref6.source, connection = _ref6.connection, credentials = _ref6.credentials, geoColumn = _ref6.geoColumn, columns = _ref6.columns, clientId = _ref6.clientId, aggregationExp = _ref6.aggregationExp, aggregationResLevel = _ref6.aggregationResLevel, queryParameters = _ref6.queryParameters; | ||
type = _ref6.type, source = _ref6.source, connection = _ref6.connection, credentials = _ref6.credentials, geoColumn = _ref6.geoColumn, columns = _ref6.columns, clientId = _ref6.clientId, headers = _ref6.headers, aggregationExp = _ref6.aggregationExp, aggregationResLevel = _ref6.aggregationResLevel, queryParameters = _ref6.queryParameters; | ||
baseUrl = "".concat(credentials.mapsUrl, "/").concat(connection, "/").concat(type); | ||
@@ -292,2 +293,3 @@ url = "".concat(baseUrl, "?").concat(getParameters({ | ||
url: baseUrl, | ||
headers: headers, | ||
accessToken: accessToken, | ||
@@ -304,2 +306,3 @@ body: body | ||
url: url, | ||
headers: headers, | ||
accessToken: accessToken | ||
@@ -369,3 +372,3 @@ }); | ||
_fetchLayerData = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee5(_ref8) { | ||
var type, source, connection, credentials, geoColumn, columns, format, formatTiles, clientId, aggregationExp, aggregationResLevel, queryParameters, _yield$_fetchDataUrl, url, accessToken, mapFormat, metadata, data, result; | ||
var type, source, connection, credentials, geoColumn, columns, format, formatTiles, clientId, headers, aggregationExp, aggregationResLevel, queryParameters, _yield$_fetchDataUrl, url, accessToken, mapFormat, metadata, data, result; | ||
@@ -376,3 +379,3 @@ return _regenerator.default.wrap(function _callee5$(_context5) { | ||
case 0: | ||
type = _ref8.type, source = _ref8.source, connection = _ref8.connection, credentials = _ref8.credentials, geoColumn = _ref8.geoColumn, columns = _ref8.columns, format = _ref8.format, formatTiles = _ref8.formatTiles, clientId = _ref8.clientId, aggregationExp = _ref8.aggregationExp, aggregationResLevel = _ref8.aggregationResLevel, queryParameters = _ref8.queryParameters; | ||
type = _ref8.type, source = _ref8.source, connection = _ref8.connection, credentials = _ref8.credentials, geoColumn = _ref8.geoColumn, columns = _ref8.columns, format = _ref8.format, formatTiles = _ref8.formatTiles, clientId = _ref8.clientId, headers = _ref8.headers, aggregationExp = _ref8.aggregationExp, aggregationResLevel = _ref8.aggregationResLevel, queryParameters = _ref8.queryParameters; | ||
_context5.next = 3; | ||
@@ -389,2 +392,3 @@ return _fetchDataUrl({ | ||
clientId: clientId, | ||
headers: headers, | ||
aggregationExp: aggregationExp, | ||
@@ -433,3 +437,3 @@ aggregationResLevel: aggregationResLevel, | ||
_fetchDataUrl2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee6(_ref9) { | ||
var type, source, connection, credentials, geoColumn, columns, format, formatTiles, clientId, aggregationExp, aggregationResLevel, queryParameters, defaultCredentials, localCreds, metadata, url, mapFormat, prioritizedFormats, _i, _prioritizedFormats, f, accessToken; | ||
var type, source, connection, credentials, geoColumn, columns, format, formatTiles, clientId, headers, aggregationExp, aggregationResLevel, queryParameters, defaultCredentials, localCreds, metadata, url, mapFormat, prioritizedFormats, _i, _prioritizedFormats, f, accessToken; | ||
@@ -440,3 +444,3 @@ return _regenerator.default.wrap(function _callee6$(_context6) { | ||
case 0: | ||
type = _ref9.type, source = _ref9.source, connection = _ref9.connection, credentials = _ref9.credentials, geoColumn = _ref9.geoColumn, columns = _ref9.columns, format = _ref9.format, formatTiles = _ref9.formatTiles, clientId = _ref9.clientId, aggregationExp = _ref9.aggregationExp, aggregationResLevel = _ref9.aggregationResLevel, queryParameters = _ref9.queryParameters; | ||
type = _ref9.type, source = _ref9.source, connection = _ref9.connection, credentials = _ref9.credentials, geoColumn = _ref9.geoColumn, columns = _ref9.columns, format = _ref9.format, formatTiles = _ref9.formatTiles, clientId = _ref9.clientId, headers = _ref9.headers, aggregationExp = _ref9.aggregationExp, aggregationResLevel = _ref9.aggregationResLevel, queryParameters = _ref9.queryParameters; | ||
defaultCredentials = (0, _config.getDefaultCredentials)(); | ||
@@ -468,2 +472,3 @@ localCreds = _objectSpread(_objectSpread({}, defaultCredentials.apiVersion === _mapsApiCommon.API_VERSIONS.V3 && defaultCredentials), credentials); | ||
clientId: clientId, | ||
headers: headers, | ||
aggregationExp: aggregationExp, | ||
@@ -543,3 +548,3 @@ aggregationResLevel: aggregationResLevel, | ||
function _fetchMapDataset(_x7, _x8, _x9, _x10, _x11) { | ||
function _fetchMapDataset(_x7, _x8, _x9, _x10, _x11, _x12) { | ||
return _fetchMapDataset2.apply(this, arguments); | ||
@@ -549,3 +554,3 @@ } | ||
function _fetchMapDataset2() { | ||
_fetchMapDataset2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee7(dataset, accessToken, credentials, clientId, queryParameters) { | ||
_fetchMapDataset2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee7(dataset, accessToken, credentials, clientId, headers, queryParameters) { | ||
var aggregationExp, aggregationResLevel, connection, columns, format, geoColumn, source, type, _yield$_fetchDataUrl2, url, mapFormat, cache; | ||
@@ -570,2 +575,3 @@ | ||
geoColumn: geoColumn, | ||
headers: headers, | ||
source: source, | ||
@@ -612,3 +618,3 @@ type: type, | ||
function _fetchTilestats(_x12, _x13, _x14, _x15) { | ||
function _fetchTilestats(_x13, _x14, _x15, _x16) { | ||
return _fetchTilestats2.apply(this, arguments); | ||
@@ -660,3 +666,3 @@ } | ||
function fillInMapDatasets(_x16, _x17, _x18) { | ||
function fillInMapDatasets(_x17, _x18, _x19, _x20) { | ||
return _fillInMapDatasets.apply(this, arguments); | ||
@@ -666,3 +672,3 @@ } | ||
function _fillInMapDatasets() { | ||
_fillInMapDatasets = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee9(_ref10, clientId, credentials) { | ||
_fillInMapDatasets = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee9(_ref10, clientId, credentials, headers) { | ||
var datasets, token, promises; | ||
@@ -675,3 +681,3 @@ return _regenerator.default.wrap(function _callee9$(_context9) { | ||
promises = datasets.map(function (dataset) { | ||
return _fetchMapDataset(dataset, token, credentials, clientId); | ||
return _fetchMapDataset(dataset, token, credentials, clientId, headers); | ||
}); | ||
@@ -694,3 +700,3 @@ _context9.next = 4; | ||
function fillInTileStats(_x19, _x20) { | ||
function fillInTileStats(_x21, _x22) { | ||
return _fillInTileStats.apply(this, arguments); | ||
@@ -785,3 +791,3 @@ } | ||
function fetchMap(_x21) { | ||
function fetchMap(_x23) { | ||
return _fetchMap.apply(this, arguments); | ||
@@ -792,3 +798,3 @@ } | ||
_fetchMap = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee12(_ref12) { | ||
var cartoMapId, clientId, credentials, autoRefresh, onNewData, defaultCredentials, localCreds, accessToken, url, map, stopAutoRefresh, intervalId, geojsonLayers, geojsonDatasetIds; | ||
var cartoMapId, clientId, credentials, headers, autoRefresh, onNewData, defaultCredentials, localCreds, accessToken, url, map, stopAutoRefresh, intervalId, geojsonLayers, geojsonDatasetIds; | ||
return _regenerator.default.wrap(function _callee12$(_context12) { | ||
@@ -798,3 +804,3 @@ while (1) { | ||
case 0: | ||
cartoMapId = _ref12.cartoMapId, clientId = _ref12.clientId, credentials = _ref12.credentials, autoRefresh = _ref12.autoRefresh, onNewData = _ref12.onNewData; | ||
cartoMapId = _ref12.cartoMapId, clientId = _ref12.clientId, credentials = _ref12.credentials, headers = _ref12.headers, autoRefresh = _ref12.autoRefresh, onNewData = _ref12.onNewData; | ||
defaultCredentials = (0, _config.getDefaultCredentials)(); | ||
@@ -821,2 +827,3 @@ localCreds = _objectSpread(_objectSpread({}, defaultCredentials.apiVersion === _mapsApiCommon.API_VERSIONS.V3 && defaultCredentials), credentials); | ||
url: url, | ||
headers: headers, | ||
accessToken: accessToken | ||
@@ -836,3 +843,3 @@ }); | ||
_context11.next = 2; | ||
return fillInMapDatasets(map, clientId, localCreds); | ||
return fillInMapDatasets(map, clientId, localCreds, headers); | ||
@@ -875,3 +882,3 @@ case 2: | ||
_context12.next = 19; | ||
return fillInMapDatasets(map, clientId, localCreds); | ||
return fillInMapDatasets(map, clientId, localCreds, headers); | ||
@@ -878,0 +885,0 @@ case 19: |
@@ -82,2 +82,7 @@ "use strict"; | ||
}, | ||
headers: { | ||
type: 'object', | ||
value: {}, | ||
optional: true | ||
}, | ||
aggregationExp: null, | ||
@@ -84,0 +89,0 @@ aggregationResLevel: null, |
@@ -109,3 +109,3 @@ "use strict"; | ||
extensions: ['pbf'], | ||
mimeTypes: ['application/x-protobuf'], | ||
mimeTypes: ['application/vnd.carto-vector-tile', 'application/x-protobuf'], | ||
category: 'geometry', | ||
@@ -112,0 +112,0 @@ worker: false, |
@@ -8,2 +8,4 @@ "use strict"; | ||
}); | ||
exports.indexToBigInt = indexToBigInt; | ||
exports.bigIntToIndex = bigIntToIndex; | ||
exports.tileToQuadbin = tileToQuadbin; | ||
@@ -10,0 +12,0 @@ exports.quadbinToTile = quadbinToTile; |
@@ -8,3 +8,3 @@ "use strict"; | ||
}); | ||
exports.TileReader = void 0; | ||
exports.TileReader = exports.NumericPropKeyValueReader = exports.PropertiesReader = void 0; | ||
@@ -58,2 +58,4 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
exports.PropertiesReader = PropertiesReader; | ||
var DoublesReader = function () { | ||
@@ -160,2 +162,4 @@ function DoublesReader() { | ||
exports.NumericPropKeyValueReader = NumericPropKeyValueReader; | ||
var PointsReader = function () { | ||
@@ -162,0 +166,0 @@ function PointsReader() { |
@@ -22,2 +22,6 @@ "use strict"; | ||
var _core = require("@loaders.gl/core"); | ||
var _cartoSpatialTileLoader = _interopRequireDefault(require("./schema/carto-spatial-tile-loader")); | ||
var _geoLayers = require("@deck.gl/geo-layers"); | ||
@@ -29,2 +33,4 @@ | ||
(0, _core.registerLoaders)([_cartoSpatialTileLoader.default]); | ||
function isFeatureIdDefined(value) { | ||
@@ -31,0 +37,0 @@ return value !== undefined && value !== null && value !== ''; |
@@ -12,6 +12,7 @@ import { getDefaultCredentials, buildMapsUrlFromBase, buildStatsUrlFromBase } from '../config'; | ||
url, | ||
headers: customHeaders, | ||
accessToken, | ||
body | ||
}) { | ||
const headers = { | ||
const headers = { ...customHeaders, | ||
Accept: 'application/json' | ||
@@ -42,2 +43,3 @@ }; | ||
url, | ||
headers, | ||
accessToken, | ||
@@ -49,2 +51,3 @@ body | ||
url, | ||
headers, | ||
accessToken, | ||
@@ -159,2 +162,3 @@ body | ||
clientId, | ||
headers, | ||
aggregationExp, | ||
@@ -188,2 +192,3 @@ aggregationResLevel, | ||
url: baseUrl, | ||
headers, | ||
accessToken, | ||
@@ -196,2 +201,3 @@ body | ||
url, | ||
headers, | ||
accessToken | ||
@@ -254,2 +260,3 @@ }); | ||
clientId, | ||
headers, | ||
aggregationExp, | ||
@@ -274,2 +281,3 @@ aggregationResLevel, | ||
clientId, | ||
headers, | ||
aggregationExp, | ||
@@ -302,2 +310,3 @@ aggregationResLevel, | ||
clientId, | ||
headers, | ||
aggregationExp, | ||
@@ -334,2 +343,3 @@ aggregationResLevel, | ||
clientId, | ||
headers, | ||
aggregationExp, | ||
@@ -377,3 +387,3 @@ aggregationResLevel, | ||
async function _fetchMapDataset(dataset, accessToken, credentials, clientId, queryParameters) { | ||
async function _fetchMapDataset(dataset, accessToken, credentials, clientId, headers, queryParameters) { | ||
const { | ||
@@ -403,2 +413,3 @@ aggregationExp, | ||
geoColumn, | ||
headers, | ||
source, | ||
@@ -454,4 +465,4 @@ type, | ||
token | ||
}, clientId, credentials) { | ||
const promises = datasets.map(dataset => _fetchMapDataset(dataset, token, credentials, clientId)); | ||
}, clientId, credentials, headers) { | ||
const promises = datasets.map(dataset => _fetchMapDataset(dataset, token, credentials, clientId, headers)); | ||
return await Promise.all(promises); | ||
@@ -511,2 +522,3 @@ } | ||
credentials, | ||
headers, | ||
autoRefresh, | ||
@@ -539,2 +551,3 @@ onNewData | ||
url, | ||
headers, | ||
accessToken | ||
@@ -546,3 +559,3 @@ }); | ||
const intervalId = setInterval(async () => { | ||
const changed = await fillInMapDatasets(map, clientId, localCreds); | ||
const changed = await fillInMapDatasets(map, clientId, localCreds, headers); | ||
@@ -570,3 +583,3 @@ if (onNewData && changed.some(v => v === true)) { | ||
}); | ||
await fillInMapDatasets(map, clientId, localCreds); | ||
await fillInMapDatasets(map, clientId, localCreds, headers); | ||
await fillInTileStats(map, localCreds); | ||
@@ -573,0 +586,0 @@ return { ...parseMap(map), |
@@ -34,2 +34,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
}, | ||
headers: { | ||
type: 'object', | ||
value: {}, | ||
optional: true | ||
}, | ||
aggregationExp: null, | ||
@@ -36,0 +41,0 @@ aggregationResLevel: null, |
@@ -69,3 +69,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
extensions: ['pbf'], | ||
mimeTypes: ['application/x-protobuf'], | ||
mimeTypes: ['application/vnd.carto-vector-tile', 'application/x-protobuf'], | ||
category: 'geometry', | ||
@@ -72,0 +72,0 @@ worker: false, |
@@ -5,11 +5,8 @@ import { worldToLngLat } from '@math.gl/web-mercator'; | ||
const S = [0n, 1n, 2n, 4n, 8n, 16n]; | ||
function indexToBigInt(index) { | ||
export function indexToBigInt(index) { | ||
return BigInt("0x".concat(index)); | ||
} | ||
function bigIntToIndex(quadbin) { | ||
export function bigIntToIndex(quadbin) { | ||
return quadbin.toString(16); | ||
} | ||
export function tileToQuadbin(tile) { | ||
@@ -16,0 +13,0 @@ if (tile.z < 0 || tile.z > 26) { |
@@ -15,3 +15,3 @@ class KeyValueObjectReader { | ||
class PropertiesReader { | ||
export class PropertiesReader { | ||
static read(pbf, end) { | ||
@@ -84,3 +84,3 @@ return pbf.readFields(PropertiesReader._readField, { | ||
class NumericPropKeyValueReader { | ||
export class NumericPropKeyValueReader { | ||
static read(pbf, end) { | ||
@@ -87,0 +87,0 @@ return pbf.readFields(NumericPropKeyValueReader._readField, { |
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
import { registerLoaders } from '@loaders.gl/core'; | ||
import CartoSpatialTileLoader from './schema/carto-spatial-tile-loader'; | ||
registerLoaders([CartoSpatialTileLoader]); | ||
import { TileLayer } from '@deck.gl/geo-layers'; | ||
@@ -3,0 +6,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "8.8.6", | ||
"version": "8.8.7", | ||
"publishConfig": { | ||
@@ -65,3 +65,3 @@ "access": "public" | ||
}, | ||
"gitHead": "a0e9fda8ed34ad91a6b25451c8df290ae025028f" | ||
"gitHead": "4485a8be47b76ba5f28447af304c683a00bbb4eb" | ||
} |
@@ -32,5 +32,7 @@ /** | ||
export type Headers = Record<string, string>; | ||
interface RequestParams { | ||
method?: string; | ||
url: string; | ||
headers?: Headers; | ||
accessToken?: string; | ||
@@ -43,4 +45,11 @@ body?: any; | ||
*/ | ||
async function request({method, url, accessToken, body}: RequestParams): Promise<Response> { | ||
const headers: Record<string, string> = { | ||
async function request({ | ||
method, | ||
url, | ||
headers: customHeaders, | ||
accessToken, | ||
body | ||
}: RequestParams): Promise<Response> { | ||
const headers: Headers = { | ||
...customHeaders, | ||
Accept: 'application/json' | ||
@@ -72,6 +81,7 @@ }; | ||
url, | ||
headers, | ||
accessToken, | ||
body | ||
}: RequestParams): Promise<T> { | ||
const response = await request({method, url, accessToken, body}); | ||
const response = await request({method, url, headers, accessToken, body}); | ||
const json = await response.json(); | ||
@@ -127,2 +137,3 @@ | ||
formatTiles?: TileFormat; | ||
headers?: Headers; | ||
aggregationExp?: string; | ||
@@ -187,2 +198,3 @@ aggregationResLevel?: number; | ||
clientId, | ||
headers, | ||
aggregationExp, | ||
@@ -212,6 +224,6 @@ aggregationResLevel, | ||
}); | ||
return await requestJson({method: 'POST', url: baseUrl, accessToken, body}); | ||
return await requestJson({method: 'POST', url: baseUrl, headers, accessToken, body}); | ||
} | ||
return await requestJson({url, accessToken}); | ||
return await requestJson({url, headers, accessToken}); | ||
} | ||
@@ -286,2 +298,3 @@ | ||
clientId, | ||
headers, | ||
aggregationExp, | ||
@@ -303,2 +316,3 @@ aggregationResLevel, | ||
clientId, | ||
headers, | ||
aggregationExp, | ||
@@ -324,2 +338,3 @@ aggregationResLevel, | ||
clientId, | ||
headers, | ||
aggregationExp, | ||
@@ -359,2 +374,3 @@ aggregationResLevel, | ||
clientId, | ||
headers, | ||
aggregationExp, | ||
@@ -402,2 +418,3 @@ aggregationResLevel, | ||
clientId?: string, | ||
headers?: Headers, | ||
queryParameters?: QueryParameters | ||
@@ -425,2 +442,3 @@ ) { | ||
geoColumn, | ||
headers, | ||
source, | ||
@@ -472,5 +490,8 @@ type, | ||
clientId: string, | ||
credentials: CloudNativeCredentials | ||
credentials: CloudNativeCredentials, | ||
headers?: Headers | ||
) { | ||
const promises = datasets.map(dataset => _fetchMapDataset(dataset, token, credentials, clientId)); | ||
const promises = datasets.map(dataset => | ||
_fetchMapDataset(dataset, token, credentials, clientId, headers) | ||
); | ||
return await Promise.all(promises); | ||
@@ -519,2 +540,3 @@ } | ||
credentials, | ||
headers, | ||
autoRefresh, | ||
@@ -526,2 +548,3 @@ onNewData | ||
credentials?: CloudNativeCredentials; | ||
headers?: Headers; | ||
autoRefresh?: number; | ||
@@ -555,3 +578,3 @@ onNewData?: (map: any) => void; | ||
const url = `${localCreds.mapsUrl}/public/${cartoMapId}`; | ||
const map = await requestJson<any>({url, accessToken}); | ||
const map = await requestJson<any>({url, headers, accessToken}); | ||
@@ -564,3 +587,3 @@ // Periodically check if the data has changed. Note that this | ||
const intervalId = setInterval(async () => { | ||
const changed = await fillInMapDatasets(map, clientId, localCreds); | ||
const changed = await fillInMapDatasets(map, clientId, localCreds, headers); | ||
if (onNewData && changed.some(v => v === true)) { | ||
@@ -586,3 +609,3 @@ onNewData(parseMap(map)); | ||
// Mutates map.datasets so that dataset.data contains data | ||
await fillInMapDatasets(map, clientId, localCreds); | ||
await fillInMapDatasets(map, clientId, localCreds, headers); | ||
@@ -589,0 +612,0 @@ // Mutates attributes in visualChannels to contain tile stats |
@@ -28,3 +28,3 @@ import { | ||
} from '../config'; | ||
import {FetchLayerDataResult} from '../api/maps-v3-client'; | ||
import {FetchLayerDataResult, Headers} from '../api/maps-v3-client'; | ||
import {assert} from '../utils'; | ||
@@ -65,2 +65,5 @@ | ||
// (Headers, optional): Custom headers to include in the map instantiation request. | ||
headers: {type: 'object', value: {}, optional: true}, | ||
// (String, optional): aggregation SQL expression. Only used for spatial index datasets | ||
@@ -153,2 +156,5 @@ aggregationExp: null, | ||
/** Custom headers to include in the map instantiation request **/ | ||
headers?: Headers; | ||
/** Aggregation SQL expression. Only used for spatial index datasets **/ | ||
@@ -155,0 +161,0 @@ aggregationExp?: string; |
@@ -15,3 +15,3 @@ /* global TextDecoder */ | ||
import {geojsonToBinary} from '@loaders.gl/gis'; | ||
import {Properties, Tile, TileReader} from './schema/carto-tile'; | ||
import {KeyValueProperties, Tile, TileReader} from './schema/carto-tile'; | ||
import {TileFormat, TILE_FORMATS} from '../api/maps-api-common'; | ||
@@ -32,3 +32,3 @@ import {LoaderOptions, LoaderWithParser} from '@loaders.gl/loader-utils'; | ||
function unpackProperties(properties: Properties[]) { | ||
function unpackProperties(properties: KeyValueProperties[]) { | ||
if (!properties || !properties.length) { | ||
@@ -72,3 +72,6 @@ return []; | ||
extensions: ['pbf'], | ||
mimeTypes: ['application/x-protobuf'], | ||
mimeTypes: [ | ||
'application/vnd.carto-vector-tile', | ||
'application/x-protobuf' // Back-compatibility | ||
], | ||
category: 'geometry', | ||
@@ -75,0 +78,0 @@ worker: false, |
@@ -15,7 +15,7 @@ import {worldToLngLat} from '@math.gl/web-mercator'; | ||
function indexToBigInt(index: string): bigint { | ||
export function indexToBigInt(index: string): bigint { | ||
return BigInt(`0x${index}`); | ||
} | ||
function bigIntToIndex(quadbin: bigint): string { | ||
export function bigIntToIndex(quadbin: bigint): string { | ||
return quadbin.toString(16); | ||
@@ -22,0 +22,0 @@ } |
@@ -19,11 +19,11 @@ // KeyValueObject ======================================== | ||
export interface Properties { | ||
export interface KeyValueProperties { | ||
data: KeyValueObject[]; | ||
} | ||
class PropertiesReader { | ||
export class PropertiesReader { | ||
static read(pbf, end?: number) { | ||
return pbf.readFields(PropertiesReader._readField, {data: []}, end); | ||
} | ||
static _readField(this: void, tag: number, obj: Properties, pbf) { | ||
static _readField(this: void, tag: number, obj: KeyValueProperties, pbf) { | ||
if (tag === 1) obj.data.push(KeyValueObjectReader.read(pbf, pbf.readVarint() + pbf.pos)); | ||
@@ -73,3 +73,3 @@ } | ||
interface NumericProp { | ||
export interface NumericProp { | ||
value: number[]; | ||
@@ -93,3 +93,3 @@ } | ||
class NumericPropKeyValueReader { | ||
export class NumericPropKeyValueReader { | ||
static read(pbf, end?: number): NumbericPropKeyValue { | ||
@@ -110,3 +110,3 @@ return pbf.readFields(NumericPropKeyValueReader._readField, {key: '', value: null}, end); | ||
featureIds: Ints; | ||
properties: Properties[]; | ||
properties: KeyValueProperties[]; | ||
numericProps: Record<string, NumericProp>; | ||
@@ -113,0 +113,0 @@ } |
@@ -0,1 +1,5 @@ | ||
import {registerLoaders} from '@loaders.gl/core'; | ||
import CartoSpatialTileLoader from './schema/carto-spatial-tile-loader'; | ||
registerLoaders([CartoSpatialTileLoader]); | ||
import {PickingInfo} from '@deck.gl/core'; | ||
@@ -2,0 +6,0 @@ import {TileLayer, _Tile2DHeader as Tile2DHeader} from '@deck.gl/geo-layers'; |
@@ -6,2 +6,3 @@ /** | ||
import { Format, MapInstantiation, MapType, QueryParameters, SchemaField, TileFormat } from './maps-api-common'; | ||
export declare type Headers = Record<string, string>; | ||
declare type FetchLayerDataParams = { | ||
@@ -17,2 +18,3 @@ type: MapType; | ||
formatTiles?: TileFormat; | ||
headers?: Headers; | ||
aggregationExp?: string; | ||
@@ -22,3 +24,3 @@ aggregationResLevel?: number; | ||
}; | ||
export declare function mapInstantiation({ type, source, connection, credentials, geoColumn, columns, clientId, aggregationExp, aggregationResLevel, queryParameters }: FetchLayerDataParams): Promise<MapInstantiation>; | ||
export declare function mapInstantiation({ type, source, connection, credentials, geoColumn, columns, clientId, headers, aggregationExp, aggregationResLevel, queryParameters }: FetchLayerDataParams): Promise<MapInstantiation>; | ||
export interface FetchLayerDataResult { | ||
@@ -29,7 +31,8 @@ data: any; | ||
} | ||
export declare function fetchLayerData({ type, source, connection, credentials, geoColumn, columns, format, formatTiles, clientId, aggregationExp, aggregationResLevel, queryParameters }: FetchLayerDataParams): Promise<FetchLayerDataResult>; | ||
export declare function fetchMap({ cartoMapId, clientId, credentials, autoRefresh, onNewData }: { | ||
export declare function fetchLayerData({ type, source, connection, credentials, geoColumn, columns, format, formatTiles, clientId, headers, aggregationExp, aggregationResLevel, queryParameters }: FetchLayerDataParams): Promise<FetchLayerDataResult>; | ||
export declare function fetchMap({ cartoMapId, clientId, credentials, headers, autoRefresh, onNewData }: { | ||
cartoMapId: string; | ||
clientId: string; | ||
credentials?: CloudNativeCredentials; | ||
headers?: Headers; | ||
autoRefresh?: number; | ||
@@ -36,0 +39,0 @@ onNewData?: (map: any) => void; |
import { CompositeLayer, CompositeLayerProps, Layer, LayerProps, UpdateParameters } from '@deck.gl/core/typed'; | ||
import { MapType, TileFormat, QueryParameters } from '../api/maps-api-common'; | ||
import { Credentials } from '../config'; | ||
import { Headers } from '../api/maps-v3-client'; | ||
/** All properties supported by CartoLayer. */ | ||
@@ -70,2 +71,4 @@ export declare type CartoLayerProps<DataT = any> = _CartoLayerProps & CompositeLayerProps<DataT>; | ||
clientId?: string; | ||
/** Custom headers to include in the map instantiation request **/ | ||
headers?: Headers; | ||
/** Aggregation SQL expression. Only used for spatial index datasets **/ | ||
@@ -72,0 +75,0 @@ aggregationExp?: string; |
@@ -0,1 +1,3 @@ | ||
export declare function indexToBigInt(index: string): bigint; | ||
export declare function bigIntToIndex(quadbin: bigint): string; | ||
export declare function tileToQuadbin(tile: any): string; | ||
@@ -2,0 +4,0 @@ export declare function quadbinToTile(index: string): { |
@@ -5,5 +5,9 @@ interface KeyValueObject { | ||
} | ||
export interface Properties { | ||
export interface KeyValueProperties { | ||
data: KeyValueObject[]; | ||
} | ||
export declare class PropertiesReader { | ||
static read(pbf: any, end?: number): any; | ||
static _readField(this: void, tag: number, obj: KeyValueProperties, pbf: any): void; | ||
} | ||
interface Doubles { | ||
@@ -17,5 +21,13 @@ value: Float32Array; | ||
} | ||
interface NumericProp { | ||
export interface NumericProp { | ||
value: number[]; | ||
} | ||
interface NumbericPropKeyValue { | ||
key: string; | ||
value: NumericProp; | ||
} | ||
export declare class NumericPropKeyValueReader { | ||
static read(pbf: any, end?: number): NumbericPropKeyValue; | ||
static _readField(this: void, tag: number, obj: NumbericPropKeyValue, pbf: any): void; | ||
} | ||
interface Points { | ||
@@ -25,3 +37,3 @@ positions: Doubles; | ||
featureIds: Ints; | ||
properties: Properties[]; | ||
properties: KeyValueProperties[]; | ||
numericProps: Record<string, NumericProp>; | ||
@@ -28,0 +40,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
3741867
201
62063